net.minecraft.world.World.spawnParticle()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(200)

本文整理了Java中net.minecraft.world.World.spawnParticle()方法的一些代码示例,展示了World.spawnParticle()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.spawnParticle()方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:spawnParticle

World.spawnParticle介绍

暂无

代码示例

代码示例来源:origin: Vazkii/Botania

  1. @SideOnly(Side.CLIENT)
  2. @Override
  3. public void handleStatusUpdate(byte id) {
  4. if(id == 3) {
  5. for(int j = 0; j < 16; j++) {
  6. world.spawnParticle(EnumParticleTypes.ITEM_CRACK, posX, posY, posZ, Math.random() * 0.2 - 0.1, Math.random() * 0.25, Math.random() * 0.2 - 0.1, Item.getIdFromItem(ModItems.vineBall));
  7. }
  8. }
  9. }

代码示例来源:origin: Vazkii/Botania

  1. @Override
  2. public boolean receiveClientEvent(int event, int param) {
  3. if(event == START_BURN_EVENT) {
  4. Entity e = getWorld().getEntityByID(param);
  5. if(e != null) {
  6. e.world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, e.posX, e.posY + 0.1, e.posZ, 0.0D, 0.0D, 0.0D);
  7. e.world.spawnParticle(EnumParticleTypes.FLAME, e.posX, e.posY, e.posZ, 0.0D, 0.0D, 0.0D);
  8. }
  9. return true;
  10. } else {
  11. return super.receiveClientEvent(event, param);
  12. }
  13. }

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

  1. @Override
  2. @SideOnly( Side.CLIENT )
  3. public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
  4. {
  5. final World world = AppEng.proxy.getWorld();
  6. world.spawnParticle( EnumParticleTypes.EXPLOSION_LARGE, this.x, this.y, this.z, 1.0D, 0.0D, 0.0D, new int[0] );
  7. }
  8. }

代码示例来源:origin: Vazkii/Botania

  1. @Override
  2. public void onLivingUpdate() {
  3. super.onLivingUpdate();
  4. if(Math.random() < 0.1)
  5. for(int j = 0; j < 3; ++j) {
  6. double d10 = func_82214_u(j);
  7. double d2 = func_82208_v(j);
  8. double d4 = func_82213_w(j);
  9. world.spawnParticle(EnumParticleTypes.HEART, d10 + rand.nextGaussian() * 0.30000001192092896D, d2 + rand.nextGaussian() * 0.30000001192092896D, d4 + rand.nextGaussian() * 0.30000001192092896D, 0.0D, 0.0D, 0.0D);
  10. }
  11. }

代码示例来源:origin: Vazkii/Botania

  1. @Override
  2. public void onDeath(@Nonnull DamageSource source) {
  3. super.onDeath(source);
  4. EntityLivingBase entitylivingbase = getAttackingEntity();
  5. if(entitylivingbase instanceof EntityPlayerMP && !anyWithArmor) {
  6. DopplegangerNoArmorTrigger.INSTANCE.trigger((EntityPlayerMP) entitylivingbase, this, source);
  7. }
  8. playSound(SoundEvents.ENTITY_GENERIC_EXPLODE, 20F, (1F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.2F) * 0.7F);
  9. world.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, posX, posY, posZ, 1D, 0D, 0D);
  10. }

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

  1. @Override
  2. public void randomDisplayTick( final World world, final BlockPos pos, final Random r )
  3. {
  4. if( this.isLevelEmitterOn() )
  5. {
  6. final AEPartLocation d = this.getSide();
  7. final double d0 = d.xOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
  8. final double d1 = d.yOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
  9. final double d2 = d.zOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
  10. world.spawnParticle( EnumParticleTypes.REDSTONE, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0.0D, 0.0D, 0.0D,
  11. new int[0] );
  12. }
  13. }

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

  1. @Override
  2. public void randomDisplayTick( final World world, final BlockPos pos, final Random r )
  3. {
  4. if( this.isLevelEmitterOn() )
  5. {
  6. final AEPartLocation d = this.getSide();
  7. final double d0 = d.xOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
  8. final double d1 = d.yOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
  9. final double d2 = d.zOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
  10. world.spawnParticle( EnumParticleTypes.REDSTONE, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0.0D, 0.0D, 0.0D,
  11. new int[0] );
  12. }
  13. }

代码示例来源:origin: Vazkii/Botania

  1. @Override
  2. public boolean receiveClientEvent(int event, int param) {
  3. if(event == EXPLODE_EFFECT_EVENT) {
  4. if(getWorld().isRemote && getWorld().getEntityByID(param) instanceof EntityTNTPrimed) {
  5. Entity e = getWorld().getEntityByID(param);
  6. for(int i = 0; i < 50; i++)
  7. Botania.proxy.sparkleFX(e.posX + Math.random() * 4 - 2, e.posY + Math.random() * 4 - 2, e.posZ + Math.random() * 4 - 2, 1F, (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, (float) (Math.random() * 0.65F + 1.25F), 12);
  8. getWorld().spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, e.posX, e.posY, e.posZ, 1D, 0D, 0D);
  9. }
  10. return true;
  11. } else {
  12. return super.receiveClientEvent(event, param);
  13. }
  14. }

代码示例来源:origin: Vazkii/Botania

  1. @Override
  2. public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
  3. TileEntity tile = world.getTileEntity(pos);
  4. if(tile instanceof TileTinyPotato) {
  5. ((TileTinyPotato) tile).interact(player, hand, player.getHeldItem(hand), par6);
  6. world.spawnParticle(EnumParticleTypes.HEART, pos.getX() + AABB.minX + Math.random() * (AABB.maxX - AABB.minX), pos.getY() + AABB.maxY, pos.getZ() + AABB.minZ + Math.random() * (AABB.maxZ - AABB.minZ), 0, 0 ,0);
  7. }
  8. return true;
  9. }

代码示例来源:origin: Vazkii/Botania

  1. @SideOnly(Side.CLIENT)
  2. @Override
  3. public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random r) {
  4. if (state.getBlock() != this)
  5. return;
  6. AltGrassVariant variant = state.getValue(BotaniaStateProps.ALTGRASS_VARIANT);
  7. switch(variant) {
  8. case DRY:
  9. break;
  10. case GOLDEN:
  11. break;
  12. case VIVID:
  13. break;
  14. case SCORCHED:
  15. if(r.nextInt(80) == 0)
  16. world.spawnParticle(EnumParticleTypes.FLAME, pos.getX() + r.nextFloat(), pos.getY() + 1.1, pos.getZ() + r.nextFloat(), 0, 0, 0);
  17. break;
  18. case INFUSED:
  19. if(r.nextInt(100) == 0)
  20. Botania.proxy.sparkleFX(pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 0F, 1F, 1F, r.nextFloat() * 0.2F + 1F, 5);
  21. break;
  22. case MUTATED:
  23. if(r.nextInt(100) == 0) {
  24. if(r.nextInt(100) > 25)
  25. Botania.proxy.sparkleFX(pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 1F, 0F, 1F, r.nextFloat() * 0.2F + 1F, 5);
  26. else Botania.proxy.sparkleFX(pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 1F, 1F, 0F, r.nextFloat() * 0.2F + 1F, 5);
  27. }
  28. break;
  29. }
  30. }

代码示例来源:origin: Vazkii/Botania

  1. world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, pos.getX() + 0.5 + Math.random() * 0.4 - 0.2, pos.getY() + 1, pos.getZ() + 0.5 + Math.random() * 0.4 - 0.2, 0, 0.05, 0);
  2. if(Math.random() > 0.9)
  3. world.spawnParticle(EnumParticleTypes.LAVA, pos.getX() + 0.5 + Math.random() * 0.4 - 0.2, pos.getY() + 1, pos.getZ() + 0.5 + Math.random() * 0.4 - 0.2, 0, 0.01, 0);

代码示例来源:origin: Vazkii/Botania

  1. @Override
  2. public boolean doParticles(IManaBurst burst, ItemStack stack) {
  3. EntityThrowable entity = (EntityThrowable) burst;
  4. ItemStack lens = burst.getSourceLens();
  5. String id = ItemNBTHelper.getString(lens, TAG_BLOCK_NAME, "minecraft:air");
  6. Block b = Block.getBlockFromName(id);
  7. int meta = ItemNBTHelper.getInt(lens, TAG_META, 0);
  8. entity.world.spawnParticle(EnumParticleTypes.BLOCK_CRACK, entity.posX, entity.posY, entity.posZ, entity.motionX, entity.motionY, entity.motionZ, Block.getStateId(b.getStateFromMeta(meta)));
  9. return true;
  10. }

代码示例来源:origin: Vazkii/Botania

  1. double m = 0.1;
  2. for(int i = 0; i < 3; i++)
  3. world.spawnParticle(EnumParticleTypes.FLAME, posX + r * (Math.random() - 0.5), posY + r * (Math.random() - 0.5), posZ + r * (Math.random() - 0.5), m * (Math.random() - 0.5), m * (Math.random() - 0.5), m * (Math.random() - 0.5));

代码示例来源:origin: Vazkii/Botania

  1. @Override
  2. public void update() {
  3. if(rotating) {
  4. lastTickRotation = rotation;
  5. rotation = (rotation + anglePerTick) % 360;
  6. rotationTicks--;
  7. if(rotationTicks <= 0) {
  8. rotating = false;
  9. // done rotating, tell neighbors
  10. world.notifyNeighborsOfStateChange(getPos(), getBlockType(), false);
  11. for(EnumFacing e : EnumFacing.VALUES) {
  12. world.notifyNeighborsOfStateChange(getPos().offset(e), getBlockType(), false);
  13. }
  14. }
  15. } else rotation = side * 90;
  16. if(world.isRemote) {
  17. int amt = rotating ? 3 : Math.random() < 0.1 ? 1 : 0;
  18. double x = getPos().getX() + 0.5 + Math.cos((rotation + 90) / 180.0 * Math.PI) * 0.35;
  19. double y = getPos().getY() + 0.2;
  20. double z = getPos().getZ() + 0.5 + Math.sin((rotation + 90) / 180.0 * Math.PI) * 0.35;
  21. for(int i = 0; i < amt; i++)
  22. world.spawnParticle(EnumParticleTypes.REDSTONE, x, y, z, 0.0D, 0.0D, 0.0D);
  23. }
  24. }

代码示例来源:origin: Vazkii/Botania

  1. moving = 0F;
  2. for(int x = 0; x < 2; x++)
  3. world.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, getPos().getX() + Math.random(), getPos().getY() + Math.random(), getPos().getZ() + Math.random(), 0, 0, 0);

代码示例来源:origin: Vazkii/Botania

  1. @Override
  2. public void onUpdate() {
  3. super.onUpdate();
  4. if(ticksExisted % 5 == 0) {
  5. List<EntitySlime> slimes = supertile.getWorld().getEntitiesWithinAABB(EntitySlime.class, new AxisAlignedBB(supertile.getPos().add(-RANGE, -RANGE, -RANGE), supertile.getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
  6. for(EntitySlime slime : slimes) {
  7. if(slime.getEntityData().getBoolean(TAG_WORLD_SPAWNED) && !slime.isDead) {
  8. int size = slime.getSlimeSize();
  9. int mul = (int) Math.pow(2, size);
  10. int mana = 1200 * mul;
  11. if(!slime.world.isRemote) {
  12. slime.setDead();
  13. slime.playSound(size > 1 ? SoundEvents.ENTITY_SLIME_SQUISH : SoundEvents.ENTITY_SMALL_SLIME_SQUISH, 1, 0.02F);
  14. this.mana = Math.min(getMaxMana(), this.mana + mana);
  15. sync();
  16. }
  17. for (int j = 0; j < mul * 8; ++j) {
  18. float f = slime.world.rand.nextFloat() * (float)Math.PI * 2.0F;
  19. float f1 = slime.world.rand.nextFloat() * 0.5F + 0.5F;
  20. float f2 = MathHelper.sin(f) * size * 0.5F * f1;
  21. float f3 = MathHelper.cos(f) * size * 0.5F * f1;
  22. float f4 = slime.world.rand.nextFloat() * size * 0.5F * f1;
  23. slime.world.spawnParticle(EnumParticleTypes.SLIME, slime.posX + f2, slime.getEntityBoundingBox().minY + f4, slime.posZ + f3, 0.0D, 0.0D, 0.0D);
  24. }
  25. break;
  26. }
  27. }
  28. }
  29. }

代码示例来源:origin: Vazkii/Botania

  1. @Nonnull
  2. @Override
  3. public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
  4. RayTraceResult rtr = rayTrace(world, player, true);
  5. ItemStack stack = player.getHeldItem(hand);
  6. if(rtr == null)
  7. return ActionResult.newResult(EnumActionResult.PASS, stack);
  8. else {
  9. if(rtr.typeOfHit == net.minecraft.util.math.RayTraceResult.Type.BLOCK) {
  10. BlockPos pos = rtr.getBlockPos();
  11. if(!world.isBlockModifiable(player, pos))
  12. return ActionResult.newResult(EnumActionResult.PASS, stack);
  13. if(!player.canPlayerEdit(pos, rtr.sideHit, stack))
  14. return ActionResult.newResult(EnumActionResult.PASS, stack);
  15. IBlockState state = world.getBlockState(pos);
  16. Fluid fluid = FluidRegistry.lookupFluidForBlock(state.getBlock());
  17. boolean isFull = state.getBlock() instanceof BlockLiquid && state.getValue(BlockLiquid.LEVEL) == 0
  18. || state.getBlock() instanceof IFluidBlock && Math.abs(((IFluidBlock) state.getBlock()).getFilledPercentage(world, pos)) >= 1;
  19. if(fluid != null && isFull) {
  20. player.playSound(fluid.getFillSound(world, pos), 1.0f, 1.0f);
  21. world.setBlockToAir(pos);
  22. for(int x = 0; x < 5; x++)
  23. world.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), 0, 0, 0);
  24. return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
  25. }
  26. }
  27. return ActionResult.newResult(EnumActionResult.PASS, stack);
  28. }
  29. }

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

  1. f3 += west_z * ( 0.3 * ox - 0.15 );
  2. w.spawnParticle( EnumParticleTypes.SMOKE_NORMAL, f1, f2, f3, 0.0D, 0.0D, 0.0D, new int[0] );
  3. w.spawnParticle( EnumParticleTypes.FLAME, f1, f2, f3, 0.0D, 0.0D, 0.0D, new int[0] );

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

  1. this.world.spawnParticle( EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D );

代码示例来源:origin: Vazkii/Botania

  1. if(burnTime > 0 && supertile.getWorld().rand.nextInt(10) == 0) {
  2. Vec3d offset = getWorld().getBlockState(getPos()).getOffset(getWorld(), getPos()).add(0.4, 0.7, 0.4);
  3. supertile.getWorld().spawnParticle(EnumParticleTypes.FLAME, supertile.getPos().getX() + offset.x + Math.random() * 0.2, supertile.getPos().getY() + offset.y, supertile.getPos().getZ() + offset.z + Math.random() * 0.2, 0.0D, 0.0D, 0.0D);

相关文章

World类方法