@SideOnly(Side.CLIENT) public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { EnumFacing enumfacing = (EnumFacing)stateIn.getValue(FACING); double d0 = (double)pos.getX() + 0.5D; double d1 = (double)pos.getY() + 0.7D; double d2 = (double)pos.getZ() + 0.5D; double d3 = 0.22D; double d4 = 0.27D; if (enumfacing.getAxis().isHorizontal()) { EnumFacing enumfacing1 = enumfacing.getOpposite(); worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + 0.27D * (double)enumfacing1.getFrontOffsetX(), d1 + 0.22D, d2 + 0.27D * (double)enumfacing1.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D, new int[0]); worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + 0.27D * (double)enumfacing1.getFrontOffsetX(), d1 + 0.22D, d2 + 0.27D * (double)enumfacing1.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D, new int[0]); } else { worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); } }
/** * Generates particle effects appropriate to the phase (or sometimes sounds). * Called by dragon's onLivingUpdate. Only used when worldObj.isRemote. */ public void doClientRenderEffects() { Vec3d vec3d = this.dragon.getHeadLookVec(1.0F).normalize(); vec3d.rotateYaw(-((float)Math.PI / 4F)); double d0 = this.dragon.dragonPartHead.posX; double d1 = this.dragon.dragonPartHead.posY + (double)(this.dragon.dragonPartHead.height / 2.0F); double d2 = this.dragon.dragonPartHead.posZ; for (int i = 0; i < 8; ++i) { double d3 = d0 + this.dragon.getRNG().nextGaussian() / 2.0D; double d4 = d1 + this.dragon.getRNG().nextGaussian() / 2.0D; double d5 = d2 + this.dragon.getRNG().nextGaussian() / 2.0D; this.dragon.worldObj.spawnParticle(EnumParticleTypes.DRAGON_BREATH, d3, d4, d5, -vec3d.xCoord * 0.07999999821186066D + this.dragon.motionX, -vec3d.yCoord * 0.30000001192092896D + this.dragon.motionY, -vec3d.zCoord * 0.07999999821186066D + this.dragon.motionZ, new int[0]); vec3d.rotateYaw(0.19634955F); } }
private void transformBedrock(World world, BlockPos pos) { Iterable<BlockPos> poslist = BlockPos.getAllInBox(pos.add(-range, -range, -range), pos.add(range, 0, range)); Iterator posit = poslist.iterator(); while (posit.hasNext()) { BlockPos looppos = (BlockPos)posit.next(); if (!world.isAirBlock(looppos) && world.getBlockState(looppos).getBlock() == Blocks.BEDROCK) { if (looppos.getY() <= 1) continue; if (world.rand.nextBoolean()) { world.setBlockState(looppos, UCBlocks.darkBlock.getDefaultState(), 2); UCPacketHandler.sendToNearbyPlayers(world, looppos, new PacketUCEffect(EnumParticleTypes.CLOUD, looppos.getX(), looppos.getY(), looppos.getZ(), 6)); return; } } } }
@SideOnly(Side.CLIENT) public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { if (rand.nextInt(16) == 0) { BlockPos blockpos = pos.down(); if (canFallThrough(worldIn.getBlockState(blockpos))) { double d0 = (double)((float)pos.getX() + rand.nextFloat()); double d1 = (double)pos.getY() - 0.05D; double d2 = (double)((float)pos.getZ() + rand.nextFloat()); worldIn.spawnParticle(EnumParticleTypes.FALLING_DUST, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[] {Block.getStateId(stateIn)}); } } }
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (stack.getItemDamage() == EnumItems.TIMEMEAL.ordinal() && player.canPlayerEdit(pos, facing, stack)) { Block crops = world.getBlockState(pos).getBlock(); if (crops != null && crops instanceof BlockCrops) { if (crops != UCBlocks.cropMerlinia) world.setBlockState(pos, ((BlockCrops)crops).withAge(0), 2); else if (crops == UCBlocks.cropMerlinia) ((Merlinia)crops).merliniaGrowth(world, pos, world.rand.nextInt(1) + 1); else if (crops instanceof BlockNetherWart) ((BlockNetherWart)crops).updateTick(world, pos, world.getBlockState(pos), world.rand); if (!player.capabilities.isCreativeMode && !player.worldObj.isRemote) stack.stackSize--; UCPacketHandler.sendToNearbyPlayers(world, pos, new PacketUCEffect(EnumParticleTypes.VILLAGER_HAPPY, pos.getX() - 0.5D, pos.getY(), pos.getZ() - 0.5D, 6)); return EnumActionResult.SUCCESS; } } return super.onItemUse(stack, player, world, pos, hand, facing, hitX, hitY, hitZ); }
@Override public void onExecutionStart(EntityPlayer player) { ItemStack is = player.getHeldItemMainhand().isEmpty() ? player.getHeldItemOffhand() : player.getHeldItemMainhand(); EnumWeaponWeight weight = EnumWeaponWeight.getWeaponWeight(is); player.world.playSound(player, player.getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_NODAMAGE, SoundCategory.PLAYERS, 1, 1F); Vec3d look = player.getLookVec().scale(5); Vec3d pos = player.getPositionVector(); List<EntityLivingBase> targets = Helpers.rayTraceEntities(player.world, pos.addVector(0, player.getEyeHeight(), 0), look, Optional.of(e -> e != player), EntityLivingBase.class); EntityLivingBase assumedToBeLookedAt = Helpers.getClosest(targets, player); if (assumedToBeLookedAt != null) { if (!player.world.isRemote) { assumedToBeLookedAt.addPotionEffect(new PotionEffect(ExPPotions.stunned, weight == EnumWeaponWeight.NORMAL ? 20 : 30, 0, false, false)); } player.world.playSound(player, player.getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_KNOCKBACK, SoundCategory.PLAYERS, 1, 1F); Vec3d targetPos = assumedToBeLookedAt.getPositionVector(); assumedToBeLookedAt.knockBack(player, 1, pos.x - targetPos.x, pos.z - targetPos.z); for (int i = 0; i < 50; ++i) { player.world.spawnParticle(EnumParticleTypes.CRIT_MAGIC, targetPos.x + player.world.rand.nextDouble() - player.world.rand.nextDouble(), targetPos.z + assumedToBeLookedAt.getEyeHeight() + player.world.rand.nextDouble() - player.world.rand.nextDouble(), targetPos.z + player.world.rand.nextDouble() - player.world.rand.nextDouble(), 0, -0.1, 0); } } }
/** * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons * use this to react to sunlight and start to burn. */ public void onLivingUpdate() { super.onLivingUpdate(); if (this.getGrowingAge() != 0) { this.inLove = 0; } if (this.inLove > 0) { --this.inLove; if (this.inLove % 10 == 0) { double d0 = this.rand.nextGaussian() * 0.02D; double d1 = this.rand.nextGaussian() * 0.02D; double d2 = this.rand.nextGaussian() * 0.02D; this.worldObj.spawnParticle(EnumParticleTypes.HEART, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d0, d1, d2, new int[0]); } } }
@SideOnly(Side.CLIENT) public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { double d0 = (double)pos.getX() + 0.5D; double d1 = (double)pos.getY() + 0.15D; double d2 = (double)pos.getZ() + 0.5D; double d3 = 0.22D; double d4 = 0.27D; if(worldIn.getTileEntity(pos) instanceof TileEntityPan) { if(((TileEntityPan)worldIn.getTileEntity(pos)).isCooking()) { worldIn.spawnParticle(EnumParticleTypes.FLAME, d0+(RANDOM.nextDouble()/1.5 - 0.35), d1, d2+(RANDOM.nextDouble()/1.5 - 0.35), 0.0D, 0.0D, 0.0D, new int[0]); worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0+(RANDOM.nextDouble()/1.5 - 0.35), d1, d2+(RANDOM.nextDouble()/1.5 - 0.35), 0.0D, 0.0D, 0.0D, new int[0]); } } }
@SideOnly(Side.CLIENT) public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { if (this.isRepeaterPowered) { EnumFacing enumfacing = (EnumFacing)stateIn.getValue(FACING); double d0 = (double)((float)pos.getX() + 0.5F) + (double)(rand.nextFloat() - 0.5F) * 0.2D; double d1 = (double)((float)pos.getY() + 0.4F) + (double)(rand.nextFloat() - 0.5F) * 0.2D; double d2 = (double)((float)pos.getZ() + 0.5F) + (double)(rand.nextFloat() - 0.5F) * 0.2D; float f = -5.0F; if (rand.nextBoolean()) { f = (float)(((Integer)stateIn.getValue(DELAY)).intValue() * 2 - 1); } f = f / 16.0F; double d3 = (double)(f * (float)enumfacing.getFrontOffsetX()); double d4 = (double)(f * (float)enumfacing.getFrontOffsetZ()); worldIn.spawnParticle(EnumParticleTypes.REDSTONE, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]); } }
/** * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons * use this to react to sunlight and start to burn. */ public void onLivingUpdate() { if (!this.onGround && this.motionY < 0.0D) { this.motionY *= 0.6D; } if (this.worldObj.isRemote) { if (this.rand.nextInt(24) == 0 && !this.isSilent()) { this.worldObj.playSound(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, "fire.fire", 1.0F + this.rand.nextFloat(), this.rand.nextFloat() * 0.7F + 0.3F, false); } for (int i = 0; i < 2; ++i) { this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, 0.0D, 0.0D, 0.0D, new int[0]); } } super.onLivingUpdate(); }
/** * Renders broken item particles using the given ItemStack */ public void renderBrokenItemStack(ItemStack stack) { this.playSound("random.break", 0.8F, 0.8F + this.worldObj.rand.nextFloat() * 0.4F); for (int i = 0; i < 5; ++i) { Vec3 vec3 = new Vec3(((double)this.rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D); vec3 = vec3.rotatePitch(-this.rotationPitch * (float)Math.PI / 180.0F); vec3 = vec3.rotateYaw(-this.rotationYaw * (float)Math.PI / 180.0F); double d0 = (double)(-this.rand.nextFloat()) * 0.6D - 0.3D; Vec3 vec31 = new Vec3(((double)this.rand.nextFloat() - 0.5D) * 0.3D, d0, 0.6D); vec31 = vec31.rotatePitch(-this.rotationPitch * (float)Math.PI / 180.0F); vec31 = vec31.rotateYaw(-this.rotationYaw * (float)Math.PI / 180.0F); vec31 = vec31.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ); this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05D, vec3.zCoord, new int[] {Item.getIdFromItem(stack.getItem())}); } }
/** * Spawns an explosion particle around the Entity's location */ public void spawnExplosionParticle() { if (this.worldObj.isRemote) { for (int i = 0; i < 20; ++i) { double d0 = this.rand.nextGaussian() * 0.02D; double d1 = this.rand.nextGaussian() * 0.02D; double d2 = this.rand.nextGaussian() * 0.02D; double d3 = 10.0D; this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width - d0 * d3, this.posY + (double)(this.rand.nextFloat() * this.height) - d1 * d3, this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width - d2 * d3, d0, d1, d2, new int[0]); } } else { this.worldObj.setEntityState(this, (byte)20); } }
private void spawnPotionParticles(int particleCount) { int i = this.getColor(); if (i != 0 && particleCount > 0) { double d0 = (double)(i >> 16 & 255) / 255.0D; double d1 = (double)(i >> 8 & 255) / 255.0D; double d2 = (double)(i >> 0 & 255) / 255.0D; for (int j = 0; j < particleCount; ++j) { this.worldObj.spawnParticle(EnumParticleTypes.SPELL_MOB, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, d0, d1, d2, new int[0]); } } }
@Override public void onUpdate() { super.onUpdate(); double velY = 0; if (this.ticksExisted > 40) { velY = 0.0625D; if (this.posY >= 256) { this.setDead(); } this.addVelocity(0, velY, 0); if (this.ticksExisted % 10 == 0 && this.isCollided) { UCPacketHandler.sendToNearbyPlayers(worldObj, getPosition(), new PacketUCEffect(EnumParticleTypes.EXPLOSION_NORMAL, this.posX, this.posY, this.posZ, 3)); this.setDead(); } } }
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if (this.isOn) { double d0 = (double)pos.getX() + 0.5D + (rand.nextDouble() - 0.5D) * 0.2D; double d1 = (double)pos.getY() + 0.7D + (rand.nextDouble() - 0.5D) * 0.2D; double d2 = (double)pos.getZ() + 0.5D + (rand.nextDouble() - 0.5D) * 0.2D; EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); if (enumfacing.getAxis().isHorizontal()) { EnumFacing enumfacing1 = enumfacing.getOpposite(); double d3 = 0.27D; d0 += 0.27D * (double)enumfacing1.getFrontOffsetX(); d1 += 0.22D; d2 += 0.27D * (double)enumfacing1.getFrontOffsetZ(); } worldIn.spawnParticle(EnumParticleTypes.REDSTONE, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); } }
@Override @Nullable public IMessage onMessage(MessageRevivalSuccess message, MessageContext ctx) { NetworkHandler.getThreadListener(ctx).addScheduledTask(() -> { Minecraft mc = Minecraft.getMinecraft(); if (message.getEntityId() == mc.player.getEntityId()) { mc.player.extinguish(); mc.player.setFlag(0, false); // burning flag if (ModConfig.glowOnDeath) { mc.player.setGlowing(false); mc.player.setFlag(6, false); // glowing flag } mc.displayGuiScreen(null); } Entity entity = mc.world.getEntityByID(message.getEntityId()); if (entity != null) { mc.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, entity.posX, entity.posY, entity.posZ, 0, 0, 0); } }); return null; }
@SideOnly(Side.CLIENT) public void createParticles(IBlockState state, World world, BlockPos pos, Random rand, EnumParticleTypes particle, int rand2) { if (this.getAge(state) >= getMaxAge()) { double x = pos.getX(); double y = pos.getY() + 0.5D; double z = pos.getZ(); for (int i = 0; i < rand.nextInt(4) + 1; i++) { if (rand2 > 0) { if (rand.nextInt(rand2) == 0) world.spawnParticle(particle, x + rand.nextFloat(), y, z + rand.nextFloat(), 0, 0, 0); } else world.spawnParticle(particle, x + rand.nextFloat(), y, z + rand.nextFloat(), 0, 0, 0); } } }
/** * Called to update the entity's position/logic. */ public void onUpdate() { for (int i = 0; i < 6; ++i) { double d0 = this.posX + (this.rand.nextDouble() - this.rand.nextDouble()) * 4.0D; double d1 = this.posY + (this.rand.nextDouble() - this.rand.nextDouble()) * 4.0D; double d2 = this.posZ + (this.rand.nextDouble() - this.rand.nextDouble()) * 4.0D; this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, d0, d1, d2, (double)((float)this.timeSinceStart / (float)this.maximumTime), 0.0D, 0.0D, new int[0]); } ++this.timeSinceStart; if (this.timeSinceStart == this.maximumTime) { this.setDead(); } }
@SideOnly(Side.CLIENT) public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { for (int i = 0; i < 3; ++i) { int j = rand.nextInt(2) * 2 - 1; int k = rand.nextInt(2) * 2 - 1; double d0 = (double)pos.getX() + 0.5D + 0.25D * (double)j; double d1 = (double)((float)pos.getY() + rand.nextFloat()); double d2 = (double)pos.getZ() + 0.5D + 0.25D * (double)k; double d3 = (double)(rand.nextFloat() * (float)j); double d4 = ((double)rand.nextFloat() - 0.5D) * 0.125D; double d5 = (double)(rand.nextFloat() * (float)k); worldIn.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5, new int[0]); } }
public void handleStatusUpdate(byte id) { if (id == 0) { int i = this.getColor(); if (i != -1) { double d0 = (double)(i >> 16 & 255) / 255.0D; double d1 = (double)(i >> 8 & 255) / 255.0D; double d2 = (double)(i >> 0 & 255) / 255.0D; for (int j = 0; j < 20; ++j) { this.world.spawnParticle(EnumParticleTypes.SPELL_MOB, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, d0, d1, d2, new int[0]); } } } else { super.handleStatusUpdate(id); } }
/** * Called to update the entity's position/logic. */ public void onUpdate() { super.onUpdate(); if (this.fuel > 0) { --this.fuel; } if (this.fuel <= 0) { this.pushX = this.pushZ = 0.0D; } this.setMinecartPowered(this.fuel > 0); if (this.isMinecartPowered() && this.rand.nextInt(4) == 0) { this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX, this.posY + 0.8D, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); } }
/** * Called to update the entity's position/logic. */ public void onUpdate() { super.onUpdate(); if (this.minecartTNTFuse > 0) { --this.minecartTNTFuse; this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); } else if (this.minecartTNTFuse == 0) { this.explodeCart(this.motionX * this.motionX + this.motionZ * this.motionZ); } if (this.isCollidedHorizontally) { double d0 = this.motionX * this.motionX + this.motionZ * this.motionZ; if (d0 >= 0.009999999776482582D) { this.explodeCart(d0); } } }
private void spawnPotionParticles(int particleCount) { int i = this.getColor(); if (i != -1 && particleCount > 0) { double d0 = (double)(i >> 16 & 255) / 255.0D; double d1 = (double)(i >> 8 & 255) / 255.0D; double d2 = (double)(i >> 0 & 255) / 255.0D; for (int j = 0; j < particleCount; ++j) { this.world.spawnParticle(EnumParticleTypes.SPELL_MOB, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, d0, d1, d2, new int[0]); } } }
/** * Called when this EntityThrowable hits a block or entity. */ protected void onImpact(MovingObjectPosition p_70184_1_) { if (p_70184_1_.entityHit != null) { int i = 0; if (p_70184_1_.entityHit instanceof EntityBlaze) { i = 3; } p_70184_1_.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)i); } for (int j = 0; j < 8; ++j) { this.worldObj.spawnParticle(EnumParticleTypes.SNOWBALL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); } if (!this.worldObj.isRemote) { this.setDead(); } }
@SideOnly(Side.CLIENT) public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { if (rand.nextInt(100) == 0) { worldIn.playSound((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_PORTAL_AMBIENT, SoundCategory.BLOCKS, 0.5F, rand.nextFloat() * 0.4F + 0.8F, false); } for (int i = 0; i < 4; ++i) { double d0 = (double)((float)pos.getX() + rand.nextFloat()); double d1 = (double)((float)pos.getY() + rand.nextFloat()); double d2 = (double)((float)pos.getZ() + rand.nextFloat()); double d3 = ((double)rand.nextFloat() - 0.5D) * 0.5D; double d4 = ((double)rand.nextFloat() - 0.5D) * 0.5D; double d5 = ((double)rand.nextFloat() - 0.5D) * 0.5D; int j = rand.nextInt(2) * 2 - 1; if (worldIn.getBlockState(pos.west()).getBlock() != this && worldIn.getBlockState(pos.east()).getBlock() != this) { d0 = (double)pos.getX() + 0.5D + 0.25D * (double)j; d3 = (double)(rand.nextFloat() * 2.0F * (float)j); } else { d2 = (double)pos.getZ() + 0.5D + 0.25D * (double)j; d5 = (double)(rand.nextFloat() * 2.0F * (float)j); } worldIn.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5, new int[0]); } }
public PacketSpawnParticle(EnumParticleTypes particle, double x, double y, double z, double dx, double dy, double dz) { super(x, y, z); particleId = particle.ordinal(); this.dx = dx; this.dy = dy; this.dz = dz; }
@Override protected void onImpact(RayTraceResult result) { if (!worldObj.isRemote) { BlockPos pos = new BlockPos(result.hitVec); if (result.typeOfHit == RayTraceResult.Type.ENTITY) { Entity ent = result.entityHit; if (!ent.isDead && ent instanceof EntityPlayer) PotionBehavior.reverseEffects((EntityPlayer)ent); } UCPacketHandler.sendToNearbyPlayers(worldObj, pos, new PacketUCEffect(EnumParticleTypes.SPELL, pos.getX() - 0.5D, pos.getY() - 0.5D, pos.getZ() - 0.5D, 5)); this.setDead(); } }
private void spawnParticles(EnumParticleTypes particleType) { for (int i = 0; i < 5; ++i) { double d0 = this.rand.nextGaussian() * 0.02D; double d1 = this.rand.nextGaussian() * 0.02D; double d2 = this.rand.nextGaussian() * 0.02D; this.worldObj.spawnParticle(particleType, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 1.0D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d0, d1, d2, new int[0]); } }
/** * handles entity death timer, experience orb and particle creation */ protected void onDeathUpdate() { ++this.deathTime; if (this.deathTime == 20) { if (!this.worldObj.isRemote && (this.isPlayer() || this.recentlyHit > 0 && this.canDropLoot() && this.worldObj.getGameRules().getBoolean("doMobLoot"))) { int i = this.getExperiencePoints(this.attackingPlayer); i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.attackingPlayer, i); while (i > 0) { int j = EntityXPOrb.getXPSplit(i); i -= j; this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j)); } } this.setDead(); for (int k = 0; k < 20; ++k) { double d2 = this.rand.nextGaussian() * 0.02D; double d0 = this.rand.nextGaussian() * 0.02D; double d1 = this.rand.nextGaussian() * 0.02D; this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d2, d0, d1, new int[0]); } } }
@Inject(method = "onEnchantmentCritical", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/EffectRenderer;emitParticleAtEntity(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/EnumParticleTypes;)V")) private void multiplyEnchantmentParticle(Entity entityHit, CallbackInfo callbackInfo) { for (int i = 0; i < PastOption.PARTICLE_MULTIPLIER.getValue().intValue() - 1; ++i) this.mc.effectRenderer.emitParticleAtEntity(entityHit, EnumParticleTypes.CRIT_MAGIC); }
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { boolean flag = this.shouldBeOff(worldIn, pos, state); List<BlockRedstoneTorch.Toggle> list = (List)toggles.get(worldIn); while (list != null && !list.isEmpty() && worldIn.getTotalWorldTime() - ((BlockRedstoneTorch.Toggle)list.get(0)).time > 60L) { list.remove(0); } if (this.isOn) { if (flag) { worldIn.setBlockState(pos, Blocks.UNLIT_REDSTONE_TORCH.getDefaultState().withProperty(FACING, state.getValue(FACING)), 3); if (this.isBurnedOut(worldIn, pos, true)) { worldIn.playSound((EntityPlayer)null, pos, SoundEvents.BLOCK_REDSTONE_TORCH_BURNOUT, SoundCategory.BLOCKS, 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F); for (int i = 0; i < 5; ++i) { double d0 = (double)pos.getX() + rand.nextDouble() * 0.6D + 0.2D; double d1 = (double)pos.getY() + rand.nextDouble() * 0.6D + 0.2D; double d2 = (double)pos.getZ() + rand.nextDouble() * 0.6D + 0.2D; worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); } worldIn.scheduleUpdate(pos, worldIn.getBlockState(pos).getBlock(), 160); } } } else if (!flag && !this.isBurnedOut(worldIn, pos, false)) { worldIn.setBlockState(pos, Blocks.REDSTONE_TORCH.getDefaultState().withProperty(FACING, state.getValue(FACING)), 3); } }
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { if (rand.nextInt(16) == 0) { BlockPos blockpos = pos.down(); if (canFallThrough(worldIn.getBlockState(blockpos))) { double d0 = (double)((float)pos.getX() + rand.nextFloat()); double d1 = (double)pos.getY() - 0.05D; double d2 = (double)((float)pos.getZ() + rand.nextFloat()); worldIn.spawnParticle(EnumParticleTypes.FALLING_DUST, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[] {Block.getStateId(stateIn)}); } } }
public SPacketParticles(EnumParticleTypes particleIn, boolean longDistanceIn, float xIn, float yIn, float zIn, float xOffsetIn, float yOffsetIn, float zOffsetIn, float speedIn, int countIn, int... argumentsIn) { this.particleType = particleIn; this.longDistance = longDistanceIn; this.xCoord = xIn; this.yCoord = yIn; this.zCoord = zIn; this.xOffset = xOffsetIn; this.yOffset = yOffsetIn; this.zOffset = zOffsetIn; this.particleSpeed = speedIn; this.particleCount = countIn; this.particleArguments = argumentsIn; }
@SideOnly(Side.CLIENT) public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { super.randomDisplayTick(stateIn, worldIn, pos, rand); for (int i = -2; i <= 2; ++i) { for (int j = -2; j <= 2; ++j) { if (i > -2 && i < 2 && j == -1) { j = 2; } if (rand.nextInt(16) == 0) { for (int k = 0; k <= 1; ++k) { BlockPos blockpos = pos.add(i, k, j); if (net.minecraftforge.common.ForgeHooks.getEnchantPower(worldIn, blockpos) > 0) { if (!worldIn.isAirBlock(pos.add(i / 2, 0, j / 2))) { break; } worldIn.spawnParticle(EnumParticleTypes.ENCHANTMENT_TABLE, (double)pos.getX() + 0.5D, (double)pos.getY() + 2.0D, (double)pos.getZ() + 0.5D, (double)((float)i + rand.nextFloat()) - 0.5D, (double)((float)k - rand.nextFloat() - 1.0F), (double)((float)j + rand.nextFloat()) - 0.5D, new int[0]); } } } } } }
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { double d0 = (double)((float)pos.getX() + 0.4F + rand.nextFloat() * 0.2F); double d1 = (double)((float)pos.getY() + 0.7F + rand.nextFloat() * 0.3F); double d2 = (double)((float)pos.getZ() + 0.4F + rand.nextFloat() * 0.2F); worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); }
private void teleport(World worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos); if (iblockstate.getBlock() == this) { for (int i = 0; i < 1000; ++i) { BlockPos blockpos = pos.add(worldIn.rand.nextInt(16) - worldIn.rand.nextInt(16), worldIn.rand.nextInt(8) - worldIn.rand.nextInt(8), worldIn.rand.nextInt(16) - worldIn.rand.nextInt(16)); if (worldIn.getBlockState(blockpos).getBlock().blockMaterial == Material.air) { if (worldIn.isRemote) { for (int j = 0; j < 128; ++j) { double d0 = worldIn.rand.nextDouble(); float f = (worldIn.rand.nextFloat() - 0.5F) * 0.2F; float f1 = (worldIn.rand.nextFloat() - 0.5F) * 0.2F; float f2 = (worldIn.rand.nextFloat() - 0.5F) * 0.2F; double d1 = (double)blockpos.getX() + (double)(pos.getX() - blockpos.getX()) * d0 + (worldIn.rand.nextDouble() - 0.5D) * 1.0D + 0.5D; double d2 = (double)blockpos.getY() + (double)(pos.getY() - blockpos.getY()) * d0 + worldIn.rand.nextDouble() * 1.0D - 0.5D; double d3 = (double)blockpos.getZ() + (double)(pos.getZ() - blockpos.getZ()) * d0 + (worldIn.rand.nextDouble() - 0.5D) * 1.0D + 0.5D; worldIn.spawnParticle(EnumParticleTypes.PORTAL, d1, d2, d3, (double)f, (double)f1, (double)f2, new int[0]); } } else { worldIn.setBlockState(blockpos, iblockstate, 2); worldIn.setBlockToAir(pos); } return; } } } }
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { super.randomDisplayTick(worldIn, pos, state, rand); if (rand.nextInt(10) == 0) { worldIn.spawnParticle(EnumParticleTypes.TOWN_AURA, (double)((float)pos.getX() + rand.nextFloat()), (double)((float)pos.getY() + 1.1F), (double)((float)pos.getZ() + rand.nextFloat()), 0.0D, 0.0D, 0.0D, new int[0]); } }
@Override public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, ParticleManager manager) { if(world != null && pos != null) if (world instanceof WorldServer) ((WorldServer)world).spawnParticle(EnumParticleTypes.CLOUD, false, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 20, 0.7, 0.7, 0.7, 0, new int[EnumParticleTypes.CLOUD.getArgumentCount()]); return super.addHitEffects(state, worldObj, target, manager); }
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { boolean flag = this.shouldBeOff(worldIn, pos, state); List<BlockRedstoneTorch.Toggle> list = (List)toggles.get(worldIn); while (list != null && !list.isEmpty() && worldIn.getTotalWorldTime() - ((BlockRedstoneTorch.Toggle)list.get(0)).time > 60L) { list.remove(0); } if (this.isOn) { if (flag) { worldIn.setBlockState(pos, Blocks.unlit_redstone_torch.getDefaultState().withProperty(FACING, state.getValue(FACING)), 3); if (this.isBurnedOut(worldIn, pos, true)) { worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), "random.fizz", 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F); for (int i = 0; i < 5; ++i) { double d0 = (double)pos.getX() + rand.nextDouble() * 0.6D + 0.2D; double d1 = (double)pos.getY() + rand.nextDouble() * 0.6D + 0.2D; double d2 = (double)pos.getZ() + rand.nextDouble() * 0.6D + 0.2D; worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); } worldIn.scheduleUpdate(pos, worldIn.getBlockState(pos).getBlock(), 160); } } } else if (!flag && !this.isBurnedOut(worldIn, pos, false)) { worldIn.setBlockState(pos, Blocks.redstone_torch.getDefaultState().withProperty(FACING, state.getValue(FACING)), 3); } }