@Override @SideOnly(Side.CLIENT) public boolean addDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) { int max = 4; for (int xOffset = 0; xOffset < max; ++xOffset) { for (int yOffset = 0; yOffset < max; ++yOffset) { for (int zOffset = 0; zOffset < max; ++zOffset) { double pX = (double) x + ((double) xOffset + 0.5D) / (double) max; double pY = (double) y + ((double) yOffset + 0.5D) / (double) max; double pZ = (double) z + ((double) zOffset + 0.5D) / (double) max; Minecraft.getMinecraft().effectRenderer.addEffect((new EntityDiggingFX(world, pX, pY, pZ, pX - (double) x - 0.5D, pY - (double) y - 0.5D, pZ - (double) z - 0.5D, ((TileIllumination) world.getTileEntity(x, y, z)).camoBlock, meta)).applyColourMultiplier(x, y, z)); } } } return true; }
public void func_78871_a(int p_78871_1_, int p_78871_2_, int p_78871_3_, int p_78871_4_, int p_78871_5_) { if(p_78871_4_ != 0) { Block var6 = Block.field_71973_m[p_78871_4_]; byte var7 = 4; for(int var8 = 0; var8 < var7; ++var8) { for(int var9 = 0; var9 < var7; ++var9) { for(int var10 = 0; var10 < var7; ++var10) { double var11 = (double)p_78871_1_ + ((double)var8 + 0.5D) / (double)var7; double var13 = (double)p_78871_2_ + ((double)var9 + 0.5D) / (double)var7; double var15 = (double)p_78871_3_ + ((double)var10 + 0.5D) / (double)var7; this.func_78873_a((new EntityDiggingFX(this.field_78878_a, var11, var13, var15, var11 - (double)p_78871_1_ - 0.5D, var13 - (double)p_78871_2_ - 0.5D, var15 - (double)p_78871_3_ - 0.5D, var6, p_78871_5_)).func_70596_a(p_78871_1_, p_78871_2_, p_78871_3_)); } } } } }
public static void spawnSculptEffect(int x, int y, int z, Block block, byte meta) { if(block==null) return; World world = Minecraft.getMinecraft().theWorld; for (int side = 0; side < 6; side++) { for (int j = 0; j < 32; j++) { EntityDiggingFX fx = addBlockHitEffects(Minecraft.getMinecraft().theWorld, x, y, z, block, meta, side); if(fx==null) return; fx.multipleParticleScaleBy(0.25f + 0.5f * rand.nextFloat()); fx.multiplyVelocity(0.3f * rand.nextFloat()); } } Minecraft.getMinecraft().theWorld.playSound(x + 0.5, y + 0.5, z + 0.5, block.stepSound.getBreakSound(), 1.0f, 0.6f + 0.4f * rand.nextFloat(), true); }
/** * Produces block destruction particles at coordinates. */ public static void addDestroyEffect(World world, int x, int y, int z, ItemStack itemStack, EffectRenderer effectRenderer) { BlockProperties.prepareItemStackForRendering(itemStack); byte factor = 4; for (int posX = 0; posX < factor; ++posX) { for (int posY = 0; posY < factor; ++posY) { for (int posZ = 0; posZ < factor; ++posZ) { double dirX = x + (posX + 0.5D) / factor; double dirY = y + (posY + 0.5D) / factor; double dirZ = z + (posZ + 0.5D) / factor; EntityDiggingFX particle = new EntityDiggingFX(world, dirX, dirY, dirZ, dirX - x - 0.5D, dirY - y - 0.5D, dirZ - z - 0.5D, BlockProperties.toBlock(itemStack), itemStack.getItemDamage()); effectRenderer.addEffect(particle.applyColourMultiplier(x, y, z)); } } } }
@Override @SideOnly(Side.CLIENT) public boolean addHitEffects(World world, MovingObjectPosition target, EffectRenderer effectRenderer) { int side = target.sideHit; int x = target.blockX; int y = target.blockY; int z = target.blockZ; if (getMaterial() != Material.air) { float offset = 0.1F; double pX = (double)x + world.rand.nextDouble() * (getBlockBoundsMaxX() - getBlockBoundsMinX() - (double)(offset * 2.0F)) + (double)offset + getBlockBoundsMinX(); double pY = (double)y + world.rand.nextDouble() * (getBlockBoundsMaxY() - getBlockBoundsMinY() - (double)(offset * 2.0F)) + (double)offset + getBlockBoundsMinY(); double pZ = (double)z + world.rand.nextDouble() * (getBlockBoundsMaxZ() - getBlockBoundsMinZ() - (double)(offset * 2.0F)) + (double)offset + getBlockBoundsMinZ(); ForgeDirection dir = ForgeDirection.getOrientation(side); pX = dir.offsetX == 0 ? pX : x + Math.max(0, dir.offsetX) + (offset * dir.offsetX); pY = dir.offsetY == 0 ? pY : y + Math.max(0, dir.offsetY) + (offset * dir.offsetY); pZ = dir.offsetZ == 0 ? pZ : z + Math.max(0, dir.offsetZ) + (offset * dir.offsetZ); effectRenderer.addEffect((new EntityDiggingFX(world, pX, pY, pZ, 0.0D, 0.0D, 0.0D, ((TileIllumination)world.getTileEntity(x, y, z)).camoBlock, world.getBlockMetadata(x, y, z)).applyColourMultiplier(x, y, z).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F))); } return true; }
public static void spawnChiselEffect(int x, int y, int z, String sound) { World world = Minecraft.getMinecraft().theWorld; for (int side = 0; side < 6; side++) { for (int j = 0; j < 16; j++) { EntityDiggingFX fx = addBlockHitEffects(Minecraft.getMinecraft().theWorld, x, y, z, side); if(fx==null) return; fx.multipleParticleScaleBy(0.25f + 0.5f * rand.nextFloat()); fx.multiplyVelocity(0.3f * rand.nextFloat()); } } GeneralClient.playChiselSound(world, x, y, z, sound); }
public static void spawnChiselEffect(int x, int y, int z, String sound) { World world = Minecraft.getMinecraft().theWorld; for (int side = 0; side < 6; side++) { for (int j = 0; j < 16; j++) { EntityDiggingFX fx = addBlockHitEffects(Minecraft.getMinecraft().theWorld, x, y, z, side); if (fx == null) return; fx.multipleParticleScaleBy(0.25f + 0.5f * rand.nextFloat()); fx.multiplyVelocity(0.3f * rand.nextFloat()); } } GeneralClient.playChiselSound(world, x, y, z, sound); }
@SideOnly(Side.CLIENT) public boolean addDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) { if(world.getBlockMetadata(x, y, z) == 2 || world.getBlockMetadata(x, y, z) == 10) { TileEntity te = world.getTileEntity(x, y, z); if(te instanceof IAdaptableTile) { IAdaptableTile tileAdaptable = (IAdaptableTile)te; if(tileAdaptable.getBlockForTexture() != null) { byte b0 = 4; for(int i1 = 0; i1 < b0; ++i1) { for(int j1 = 0; j1 < b0; ++j1) { for(int k1 = 0; k1 < b0; ++k1) { double d0 = (double)x + ((double)i1 + 0.5D) / (double)b0; double d1 = (double)y + ((double)j1 + 0.5D) / (double)b0; double d2 = (double)z + ((double)k1 + 0.5D) / (double)b0; effectRenderer.addEffect((new EntityDiggingFX(world, d0, d1, d2, d0 - (double)x - 0.5D, d1 - (double)y - 0.5D, d2 - (double)z - 0.5D, tileAdaptable.getBlockForTexture(), tileAdaptable.getBlockMetadataForTexture())).applyColourMultiplier(x, y, z)); } } } return true; } } } return super.addDestroyEffects(world, x, y, z, meta, effectRenderer); }
public static void spawnAutoChiselFX(TileEntityAutoChisel te, ItemStack base) { if (base != null && Minecraft.getMinecraft().gameSettings.particleSetting == 0) { for (int i = 0; i < 10; i++) { EntityDiggingFX particle = new EntityDiggingFX(te.getWorldObj(), te.xCoord + 0.5, te.yCoord + 0.95, te.zCoord + 0.5, 0, 0, 0, Block.getBlockFromItem(base.getItem()), base.getItemDamage()); particle.setVelocity((te.getWorldObj().rand.nextDouble() / 4) - 0.125, te.getWorldObj().rand.nextDouble() / 8, (te.getWorldObj().rand.nextDouble() / 4) - 0.125); Minecraft.getMinecraft().effectRenderer.addEffect(particle); } String sound = Carving.chisel.getVariationSound(base.getItem(), base.getItemDamage()); GeneralClient.playChiselSound(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, sound); } }
@SideOnly(Side.CLIENT) public static boolean addBlockDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer, Block block, int metadata, int side) { byte size = 4; for(int i = 0; i < size; i++) { for(int j = 0; j < size; j++) { for(int k = 0; k < size; k++) { double xx = (double) x + ((double) i + 0.5D) / (double) size; double yy = (double) y + ((double) j + 0.5D) / (double) size; double zz = (double) z + ((double) k + 0.5D) / (double) size; effectRenderer.addEffect((new EntityDiggingFX(world, xx, yy, zz, xx - (double) x - 0.5D, yy - (double) y - 0.5D, zz - (double) z - 0.5D, block, metadata, side)).applyColourMultiplier(x, y, z)); } } } return true; }
@SideOnly(Side.CLIENT) public static boolean addBlockHitEffects(World world, MovingObjectPosition target, EffectRenderer effectRenderer, int metadata, int side) { int x = target.blockX; int y = target.blockY; int z = target.blockZ; int sideHit = target.sideHit; Block block = world.getBlock(x, y, z); float f = 0.1F; double xx = (double) x + world.rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (double) (f * 2.0F)) + (double) f + block.getBlockBoundsMinX(); double yy = (double) y + world.rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (double) (f * 2.0F)) + (double) f + block.getBlockBoundsMinY(); double zz = (double) z + world.rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (double) (f * 2.0F)) + (double) f + block.getBlockBoundsMinZ(); if(sideHit == 0) { yy = (double) y + block.getBlockBoundsMinY() - (double) f; } if(sideHit == 1) { yy = (double) y + block.getBlockBoundsMaxY() + (double) f; } if(sideHit == 2) { zz = (double) z + block.getBlockBoundsMinZ() - (double) f; } if(sideHit == 3) { zz = (double) z + block.getBlockBoundsMaxZ() + (double) f; } if(sideHit == 4) { xx = (double) x + block.getBlockBoundsMinX() - (double) f; } if(sideHit == 5) { xx = (double) x + block.getBlockBoundsMaxX() + (double) f; } effectRenderer.addEffect((new EntityDiggingFX(world, xx, yy, zz, 0.0D, 0.0D, 0.0D, block, metadata, side)).applyColourMultiplier(x, y, z).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F)); return true; }
@SideOnly(Side.CLIENT) @Override public boolean addDestroyEffects (World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) { TileEntityWoodProxy te = getTileEntity(world, x, y, z); BlockThinLog block = getBlock(world, x, y, z); if (te == null || block == null) return false; int protoMeta = te.getProtoMeta(); Block protoBlock = te.getProtoBlock(); if (protoBlock == null) { protoBlock = Blocks.log; protoMeta = world.getBlockMetadata(x, y, z); } try { byte count = 4; for (int ix = 0; ix < count; ++ix) { for (int iy = 0; iy < count; ++iy) { for (int iz = 0; iz < count; ++iz) { double xOff = (double)x + ((double)ix + 0.5D) / (double)count; double yOff = (double)y + ((double)iy + 0.5D) / (double)count; double zOff = (double)z + ((double)iz + 0.5D) / (double)count; EntityDiggingFX fx = new EntityDiggingFX(world, xOff, yOff, zOff, xOff - (double) x - 0.5D, yOff - (double) y - 0.5D, zOff - (double) z - 0.5D, this, meta); fx.setParticleIcon(block.getIcon(world.rand.nextInt(6), te.composeMetadata(protoBlock, protoMeta))); effectRenderer.addEffect(fx.applyColourMultiplier(x, y, z)); } } } } catch (Exception e) { } return true; }
@SideOnly(Side.CLIENT) @Override public boolean addDestroyEffects (World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) { TileEntityWoodProxy te = getTileEntity(world, x, y, z); BlockThinLogFence block = getBlock(world, x, y, z); if (te == null || block == null) return false; int protoMeta = te.getProtoMeta(); Block protoBlock = te.getProtoBlock(); if (protoBlock == null) { protoBlock = Blocks.log; protoMeta = world.getBlockMetadata(x, y, z); } try { byte count = 4; for (int ix = 0; ix < count; ++ix) { for (int iy = 0; iy < count; ++iy) { for (int iz = 0; iz < count; ++iz) { double xOff = (double)x + ((double)ix + 0.5D) / (double)count; double yOff = (double)y + ((double)iy + 0.5D) / (double)count; double zOff = (double)z + ((double)iz + 0.5D) / (double)count; EntityDiggingFX fx = new EntityDiggingFX(world, xOff, yOff, zOff, xOff - (double) x - 0.5D, yOff - (double) y - 0.5D, zOff - (double) z - 0.5D, this, meta); fx.setParticleIcon(block.getIcon(world.rand.nextInt(6), te.composeMetadata(protoBlock, protoMeta))); effectRenderer.addEffect(fx.applyColourMultiplier(x, y, z)); } } } } catch (Exception e) { } return true; }
public static boolean addBlockDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer, Block block, int metadata) { byte size = 4; for(int i = 0; i < size; i++) { for(int j = 0; j < size; j++) { for(int k = 0; k < size; k++) { double xx = (double) x + ((double) i + 0.5D) / (double) size; double yy = (double) y + ((double) j + 0.5D) / (double) size; double zz = (double) z + ((double) k + 0.5D) / (double) size; effectRenderer.addEffect((new EntityDiggingFX(world, xx, yy, zz, xx - (double) x - 0.5D, yy - (double) y - 0.5D, zz - (double) z - 0.5D, block, metadata)).applyColourMultiplier(x, y, z)); } } } return true; }
public static boolean addBlockHitEffects(World world, MovingObjectPosition target, EffectRenderer effectRenderer, int metadata) { int x = target.blockX; int y = target.blockY; int z = target.blockZ; int sideHit = target.sideHit; Block block = world.getBlock(x, y, z); float f = 0.1F; double xx = (double) x + world.rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (double) (f * 2.0F)) + (double) f + block.getBlockBoundsMinX(); double yy = (double) y + world.rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (double) (f * 2.0F)) + (double) f + block.getBlockBoundsMinY(); double zz = (double) z + world.rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (double) (f * 2.0F)) + (double) f + block.getBlockBoundsMinZ(); if(sideHit == 0) { yy = (double) y + block.getBlockBoundsMinY() - (double) f; } if(sideHit == 1) { yy = (double) y + block.getBlockBoundsMaxY() + (double) f; } if(sideHit == 2) { zz = (double) z + block.getBlockBoundsMinZ() - (double) f; } if(sideHit == 3) { zz = (double) z + block.getBlockBoundsMaxZ() + (double) f; } if(sideHit == 4) { xx = (double) x + block.getBlockBoundsMinX() - (double) f; } if(sideHit == 5) { xx = (double) x + block.getBlockBoundsMaxX() + (double) f; } effectRenderer.addEffect((new EntityDiggingFX(world, xx, yy, zz, 0.0D, 0.0D, 0.0D, block, metadata)).applyColourMultiplier(x, y, z).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F)); return true; }
public void func_78867_a(int p_78867_1_, int p_78867_2_, int p_78867_3_, int p_78867_4_) { int var5 = this.field_78878_a.func_72798_a(p_78867_1_, p_78867_2_, p_78867_3_); if(var5 != 0) { Block var6 = Block.field_71973_m[var5]; float var7 = 0.1F; double var8 = (double)p_78867_1_ + this.field_78875_d.nextDouble() * (var6.func_83007_w() - var6.func_83009_v() - (double)(var7 * 2.0F)) + (double)var7 + var6.func_83009_v(); double var10 = (double)p_78867_2_ + this.field_78875_d.nextDouble() * (var6.func_83010_y() - var6.func_83008_x() - (double)(var7 * 2.0F)) + (double)var7 + var6.func_83008_x(); double var12 = (double)p_78867_3_ + this.field_78875_d.nextDouble() * (var6.func_83006_A() - var6.func_83005_z() - (double)(var7 * 2.0F)) + (double)var7 + var6.func_83005_z(); if(p_78867_4_ == 0) { var10 = (double)p_78867_2_ + var6.func_83008_x() - (double)var7; } if(p_78867_4_ == 1) { var10 = (double)p_78867_2_ + var6.func_83010_y() + (double)var7; } if(p_78867_4_ == 2) { var12 = (double)p_78867_3_ + var6.func_83005_z() - (double)var7; } if(p_78867_4_ == 3) { var12 = (double)p_78867_3_ + var6.func_83006_A() + (double)var7; } if(p_78867_4_ == 4) { var8 = (double)p_78867_1_ + var6.func_83009_v() - (double)var7; } if(p_78867_4_ == 5) { var8 = (double)p_78867_1_ + var6.func_83007_w() + (double)var7; } this.func_78873_a((new EntityDiggingFX(this.field_78878_a, var8, var10, var12, 0.0D, 0.0D, 0.0D, var6, this.field_78878_a.func_72805_g(p_78867_1_, p_78867_2_, p_78867_3_))).func_70596_a(p_78867_1_, p_78867_2_, p_78867_3_).func_70543_e(0.2F).func_70541_f(0.6F)); } }
public static EntityDiggingFX addBlockHitEffects(World world, int x, int y, int z, Block block, int meta, int side) { EffectRenderer renderer = Minecraft.getMinecraft().effectRenderer; if(block==null) return null; float f = 0.1F; double d0 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F) + f + block.getBlockBoundsMinX(); double d1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F) + f + block.getBlockBoundsMinY(); double d2 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F) + f + block.getBlockBoundsMinZ(); switch (side) { case 0: d1 = y + block.getBlockBoundsMinY() - f; break; case 1: d1 = y + block.getBlockBoundsMaxY() + f; break; case 2: d2 = z + block.getBlockBoundsMinZ() - f; break; case 3: d2 = z + block.getBlockBoundsMaxZ() + f; break; case 4: d0 = x + block.getBlockBoundsMinX() - f; break; case 5: d0 = x + block.getBlockBoundsMaxX() + f; break; } EntityDiggingFX res = new EntityDiggingFX(world, d0, d1, d2, 0.0D, 0.0D, 0.0D, block, meta, side); res.motionX = d0 - (x + 0.5); res.motionY = d1 - (y + 0.5); res.motionZ = d2 - (z + 0.5); renderer.addEffect(res); return res; }
public static void spawnCopyEffect(World world, int x, int y, int z, int side, float hx, float hy, float hz, TileEntityStatue statue) { world.playSound(x + 0.5, y + 0.5, z + 0.5, "statues:copy", 2.0F, world.rand.nextFloat()*0.4f+0.8f, false); for(int i=0;i<8;i++){ EntityDiggingFX fx = addBlockHitEffects(Minecraft.getMinecraft().theWorld, x, y, z, statue.block, statue.meta, side); if(fx==null) return; fx.setPosition(x+hx, y+hy, z+hz); fx.multipleParticleScaleBy(0.15f + 0.7f * rand.nextFloat()); fx.multiplyVelocity(0.3f * rand.nextFloat()); } }
/** * Produces block hit particles at coordinates. */ public static void addHitEffect(TEBase TE, MovingObjectPosition target, double x, double y, double z, ItemStack itemStack, EffectRenderer effectRenderer) { BlockProperties.prepareItemStackForRendering(itemStack); EntityDiggingFX particle = new EntityDiggingFX(TE.getWorldObj(), x, y, z, 0.0D, 0.0D, 0.0D, BlockProperties.toBlock(itemStack), itemStack.getItemDamage()); effectRenderer.addEffect(particle.applyColourMultiplier(target.blockX, target.blockY, target.blockZ).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F)); }
public FXCycloneRing(World world, double x, double y, double z, float yaw, float pitch, float alpha, EffectRenderer renderer) { super(world, x, y, z, 0, 0, 0); axis = Vec3.createVectorHelper(0, 1, 0); particleGravity = 0; this.yaw = yaw; this.pitch = pitch; axis.rotateAroundX(pitch); axis.rotateAroundY(yaw); ringHeight = ascendVelocity; // starts just a bit off the ground baseAngle = 0; this.particleAlpha = alpha; puffs = new EntityFX[puffsPerRing]; for (int i = 0; i < puffsPerRing; i++) { if (Math.random() < 0.07) { // Add *dust* of the block below instead of the smoke puff int xInt = MathHelper.floor_double(x); int yInt = MathHelper.floor_double(y) - 1; int zInt = MathHelper.floor_double(z); int blockId = world.getBlockId(xInt, yInt, zInt); if (blockId > 0) { int metadata = world.getBlockMetadata(xInt, yInt, zInt); // The "y + 0.1" below is a workaround for the bug that digging // particles stayed on the ground and didn't fly up for some reason. puffs[i] = new EntityDiggingFX(world, x + 0.5, y+0.1, z + 0.5, 0, 0, 0, Block.blocksList[blockId], SideHit.TOP, metadata).applyColourMultiplier(xInt, yInt, zInt).multipleParticleScaleBy(0.5f); renderer.addEffect(puffs[i]); continue; } } puffs[i] = new ParticleCyclone(world, x + 0.5, y, z + 0.5, 0, 0, 0); puffs[i].setAlphaF(particleAlpha); renderer.addEffect(puffs[i]); } dAngle = MathUtil._2_PI / ((float) puffs.length); }
@SideOnly(Side.CLIENT) @Override public boolean addDestroyEffects (World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) { TileEntityLargePot te = getAttachedPotEntity(world, x, y, z); if (te == null || te.getFlowerPotItem() == null) return true; Block proxy = Block.getBlockFromItem(te.getFlowerPotItem()); if (proxy == null || proxy == Blocks.air) return true; try { byte count = 4; for (int ix = 0; ix < count; ++ix) { for (int iy = 0; iy < count; ++iy) { for (int iz = 0; iz < count; ++iz) { double xOff = (double)x + ((double)ix + 0.5D) / (double)count; double yOff = (double)y + ((double)iy + 0.5D) / (double)count; double zOff = (double)z + ((double)iz + 0.5D) / (double)count; EntityDiggingFX fx = new EntityDiggingFX(world, xOff, yOff, zOff, xOff - (double) x - 0.5D, yOff - (double) y - 0.5D, zOff - (double) z - 0.5D, this, meta); fx.setParticleIcon(proxy.getIcon(world.rand.nextInt(6), te.getFlowerPotData())); effectRenderer.addEffect(fx.applyColourMultiplier(x, y, z)); } } } } catch (Exception e) { FMLLog.log(ModularPots.MOD_ID, Level.WARN, "Exception passing through addDestroyEffects(): " + e.getMessage()); } return true; }
@SideOnly(Side.CLIENT) public static boolean addBlockDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer, Block block, int metadata) { byte size = 4; for(int i = 0; i < size; i++) { for(int j = 0; j < size; j++) { for(int k = 0; k < size; k++) { double xx = (double) x + ((double) i + 0.5D) / (double) size; double yy = (double) y + ((double) j + 0.5D) / (double) size; double zz = (double) z + ((double) k + 0.5D) / (double) size; effectRenderer.addEffect((new EntityDiggingFX(world, xx, yy, zz, xx - (double) x - 0.5D, yy - (double) y - 0.5D, zz - (double) z - 0.5D, block, metadata)).applyColourMultiplier(x, y, z)); } } } return true; }
@SideOnly(Side.CLIENT) public static boolean addBlockHitEffects(World world, MovingObjectPosition target, EffectRenderer effectRenderer, int metadata) { int x = target.blockX; int y = target.blockY; int z = target.blockZ; int sideHit = target.sideHit; Block block = Block.blocksList[world.getBlockId(x, y, z)]; float f = 0.1F; double xx = (double) x + world.rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (double) (f * 2.0F)) + (double) f + block.getBlockBoundsMinX(); double yy = (double) y + world.rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (double) (f * 2.0F)) + (double) f + block.getBlockBoundsMinY(); double zz = (double) z + world.rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (double) (f * 2.0F)) + (double) f + block.getBlockBoundsMinZ(); if(sideHit == 0) { yy = (double) y + block.getBlockBoundsMinY() - (double) f; } if(sideHit == 1) { yy = (double) y + block.getBlockBoundsMaxY() + (double) f; } if(sideHit == 2) { zz = (double) z + block.getBlockBoundsMinZ() - (double) f; } if(sideHit == 3) { zz = (double) z + block.getBlockBoundsMaxZ() + (double) f; } if(sideHit == 4) { xx = (double) x + block.getBlockBoundsMinX() - (double) f; } if(sideHit == 5) { xx = (double) x + block.getBlockBoundsMaxX() + (double) f; } effectRenderer.addEffect((new EntityDiggingFX(world, xx, yy, zz, 0.0D, 0.0D, 0.0D, block, metadata)).applyColourMultiplier(x, y, z).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F)); return true; }
@Override @SideOnly(Side.CLIENT) public boolean addDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) { Block block = world.getBlock(x, y, z); TileEntity tileentity = world.getTileEntity(x, y, z); if (block != null && block == this && tileentity != null && tileentity instanceof TileClayOven) { TileClayOven te = (TileClayOven)tileentity; int buildStage = te.getBuildStage(); int curingStage = te.getCuringStage(); byte b0 = 4; for (int i1 = 0; i1 < b0; ++i1) { for (int j1 = 0; j1 < b0; ++j1) { for (int k1 = 0; k1 < b0; ++k1) { double d0 = (double)x + ((double)i1 + 0.5D) / (double)b0; double d1 = (double)y + ((double)j1 + 0.5D) / (double)b0; double d2 = (double)z + ((double)k1 + 0.5D) / (double)b0; EntityDiggingFX digging = new EntityDiggingFX(world, d0, d1, d2, d0 - (double)x - 0.5D, d1 - (double)y - 0.5D, d2 - (double)z - 0.5D, block, meta); digging.applyColourMultiplier(x, y, z); if(buildStage <= Constants.CHIMNEY && curingStage == 2) digging.setParticleIcon(ClayOven[1]); else if(buildStage <= Constants.CHIMNEY && curingStage >= 3) digging.setParticleIcon(ClayOven[2]); else if(buildStage == Constants.INTERIOR && (curingStage == 1 || curingStage == 4)) digging.setParticleIcon(ClayOven[2]); else if(buildStage == Constants.INTERIOR && curingStage == 2) digging.setParticleIcon(ClayOven[3]); else if(buildStage == Constants.CURED) digging.setParticleIcon(ClayOven[4]); else digging.setParticleIcon(ClayOven[0]); effectRenderer.addEffect(digging); } } } } return true; }
@Override @SideOnly(Side.CLIENT) public boolean addDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) { Block block = world.getBlock(x, y, z); TileEntity tileentity = world.getTileEntity(x, y, z); if (block != null && block == this && tileentity != null && tileentity instanceof TileSandwich) { TileSandwich te = (TileSandwich)tileentity; Item toast = (te.getSandwichContents()[0]).getItem(); byte b0 = 2; for (int i1 = 0; i1 < b0; ++i1) { for (int j1 = 0; j1 < b0; ++j1) { for (int k1 = 0; k1 < b0; ++k1) { double d0 = (double)x + ((double)i1 + 0.5D) / (double)b0; double d1 = (double)y + ((double)j1 + 0.5D) / (double)b0; double d2 = (double)z + ((double)k1 + 0.5D) / (double)b0; EntityDiggingFX digging = new EntityDiggingFX(world, d0, d1, d2, d0 - (double)x - 0.5D, d1 - (double)y - 0.5D, d2 - (double)z - 0.5D, block, meta); digging.applyColourMultiplier(x, y, z); if(toast == TFCItems.barleyBread) digging.setParticleIcon(ToastTop[0]); else if(toast == TFCItems.cornBread) digging.setParticleIcon(ToastTop[1]); else if(toast == TFCItems.oatBread) digging.setParticleIcon(ToastTop[2]); else if(toast == TFCItems.riceBread) digging.setParticleIcon(ToastTop[3]); else if(toast == TFCItems.ryeBread) digging.setParticleIcon(ToastTop[4]); else digging.setParticleIcon(ToastTop[5]); effectRenderer.addEffect(digging); } } } } return true; }
public static EntityDiggingFX addBlockHitEffects(World world, int x, int y, int z, int side) { Block block = world.getBlock(x, y, z); if (block.isAir(world, x, y, z)) return null; EffectRenderer renderer = Minecraft.getMinecraft().effectRenderer; float f = 0.1F; double d0 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F) + f + block.getBlockBoundsMinX(); double d1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F) + f + block.getBlockBoundsMinY(); double d2 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F) + f + block.getBlockBoundsMinZ(); switch (side) { case 0: d1 = y + block.getBlockBoundsMinY() - f; break; case 1: d1 = y + block.getBlockBoundsMaxY() + f; break; case 2: d2 = z + block.getBlockBoundsMinZ() - f; break; case 3: d2 = z + block.getBlockBoundsMaxZ() + f; break; case 4: d0 = x + block.getBlockBoundsMinX() - f; break; case 5: d0 = x + block.getBlockBoundsMaxX() + f; break; } EntityDiggingFX res = new EntityDiggingFX(world, d0, d1, d2, 0.0D, 0.0D, 0.0D, block, world.getBlockMetadata(x, y, z), side); // res.func_70596_a(x, y, z); res.motionX = d0 - (x + 0.5); res.motionY = d1 - (y + 0.5); res.motionZ = d2 - (z + 0.5); renderer.addEffect(res); return res; }
public static EntityDiggingFX addBlockHitEffects(World world, int x, int y, int z, int side) { Block block = world.getBlock(x, y, z); if (block == null) return null; EffectRenderer renderer = Minecraft.getMinecraft().effectRenderer; float f = 0.1F; double d0 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F) + f + block.getBlockBoundsMinX(); double d1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F) + f + block.getBlockBoundsMinY(); double d2 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F) + f + block.getBlockBoundsMinZ(); switch (side) { case 0: d1 = y + block.getBlockBoundsMinY() - f; break; case 1: d1 = y + block.getBlockBoundsMaxY() + f; break; case 2: d2 = z + block.getBlockBoundsMinZ() - f; break; case 3: d2 = z + block.getBlockBoundsMaxZ() + f; break; case 4: d0 = x + block.getBlockBoundsMinX() - f; break; case 5: d0 = x + block.getBlockBoundsMaxX() + f; break; } EntityDiggingFX res = new EntityDiggingFX(world, d0, d1, d2, 0.0D, 0.0D, 0.0D, block, world.getBlockMetadata(x, y, z), side); // res.func_70596_a(x, y, z); res.motionX = d0 - (x + 0.5); res.motionY = d1 - (y + 0.5); res.motionZ = d2 - (z + 0.5); renderer.addEffect(res); return res; }
@SideOnly(Side.CLIENT) public boolean addHitEffects(World world, MovingObjectPosition target, EffectRenderer effectRenderer) { if(world.getBlockMetadata(target.blockX, target.blockY, target.blockZ) == 2 || world.getBlockMetadata(target.blockX, target.blockY, target.blockZ) == 10) { TileEntity te = world.getTileEntity(target.blockX, target.blockY, target.blockZ); if(te instanceof IAdaptableTile) { IAdaptableTile tileAdaptable = (IAdaptableTile)te; if(tileAdaptable.getBlockForTexture() != null) { float f = 0.1F; double d0 = (double)target.blockX + world.rand.nextDouble() * (tileAdaptable.getBlockForTexture().getBlockBoundsMaxX() - tileAdaptable.getBlockForTexture().getBlockBoundsMinX() - (double)(f * 2.0F)) + (double)f + tileAdaptable.getBlockForTexture().getBlockBoundsMinX(); double d1 = (double)target.blockY + world.rand.nextDouble() * (tileAdaptable.getBlockForTexture().getBlockBoundsMaxY() - tileAdaptable.getBlockForTexture().getBlockBoundsMinY() - (double)(f * 2.0F)) + (double)f + tileAdaptable.getBlockForTexture().getBlockBoundsMinY(); double d2 = (double)target.blockZ + world.rand.nextDouble() * (tileAdaptable.getBlockForTexture().getBlockBoundsMaxZ() - tileAdaptable.getBlockForTexture().getBlockBoundsMinZ() - (double)(f * 2.0F)) + (double)f + tileAdaptable.getBlockForTexture().getBlockBoundsMinZ(); if(target.sideHit == 0) { d1 = (double)target.blockY + tileAdaptable.getBlockForTexture().getBlockBoundsMinY() - (double)f; } if(target.sideHit == 1) { d1 = (double)target.blockY + tileAdaptable.getBlockForTexture().getBlockBoundsMaxY() + (double)f; } if(target.sideHit == 2) { d2 = (double)target.blockZ + tileAdaptable.getBlockForTexture().getBlockBoundsMinZ() - (double)f; } if(target.sideHit == 3) { d2 = (double)target.blockZ + tileAdaptable.getBlockForTexture().getBlockBoundsMaxZ() + (double)f; } if(target.sideHit == 4) { d0 = (double)target.blockX + tileAdaptable.getBlockForTexture().getBlockBoundsMinX() - (double)f; } if(target.sideHit == 5) { d0 = (double)target.blockX + tileAdaptable.getBlockForTexture().getBlockBoundsMaxX() + (double)f; } effectRenderer.addEffect((new EntityDiggingFX(world, d0, d1, d2, 0.0D, 0.0D, 0.0D, tileAdaptable.getBlockForTexture(), tileAdaptable.getBlockMetadataForTexture())).applyColourMultiplier(target.blockX, target.blockY, target.blockZ).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F)); return true; } } } return super.addHitEffects(world, target, effectRenderer); }
public static EntityDiggingFX addBlockHitEffects(World world, int x, int y, int z, int side) { Block block = world.getBlock(x, y, z); if (block.isAir(world, x, y, z) || Minecraft.getMinecraft().gameSettings.particleSetting != 0) return null; EffectRenderer renderer = Minecraft.getMinecraft().effectRenderer; float f = 0.1F; double d0 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F) + f + block.getBlockBoundsMinX(); double d1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F) + f + block.getBlockBoundsMinY(); double d2 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F) + f + block.getBlockBoundsMinZ(); switch (side) { case 0: d1 = y + block.getBlockBoundsMinY() - f; break; case 1: d1 = y + block.getBlockBoundsMaxY() + f; break; case 2: d2 = z + block.getBlockBoundsMinZ() - f; break; case 3: d2 = z + block.getBlockBoundsMaxZ() + f; break; case 4: d0 = x + block.getBlockBoundsMinX() - f; break; case 5: d0 = x + block.getBlockBoundsMaxX() + f; break; } EntityDiggingFX res = new EntityDiggingFX(world, d0, d1, d2, 0.0D, 0.0D, 0.0D, block, world.getBlockMetadata(x, y, z), side); res.motionX = d0 - (x + 0.5); res.motionY = d1 - (y + 0.5); res.motionZ = d2 - (z + 0.5); renderer.addEffect(res); return res; }
@SideOnly(Side.CLIENT) @Override public boolean addHitEffects (World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) { TileEntityWoodProxy te = getTileEntity(worldObj, target.blockX, target.blockY, target.blockZ); BlockThinLog block = getBlock(worldObj, target.blockX, target.blockY, target.blockZ); if (te == null || block == null) return false; int protoMeta = te.getProtoMeta(); Block protoBlock = te.getProtoBlock(); if (protoBlock == null) { protoBlock = Blocks.log; protoMeta = worldObj.getBlockMetadata(target.blockX, target.blockY, target.blockZ); } float f = 0.1F; double xPos = target.blockX + worldObj.rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (f * 2.0F)) + f + block.getBlockBoundsMinX(); double yPos = target.blockY + worldObj.rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (f * 2.0F)) + f + block.getBlockBoundsMinY(); double zPos = target.blockZ + worldObj.rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (f * 2.0F)) + f + block.getBlockBoundsMinZ(); if (target.sideHit == 0) yPos = target.blockY + block.getBlockBoundsMinY() - f; if (target.sideHit == 1) yPos = target.blockY + block.getBlockBoundsMaxY() + f; if (target.sideHit == 2) zPos = target.blockZ + block.getBlockBoundsMinZ() - f; if (target.sideHit == 3) zPos = target.blockZ + block.getBlockBoundsMaxZ() + f; if (target.sideHit == 4) xPos = target.blockX + block.getBlockBoundsMinX() - f; if (target.sideHit == 5) xPos = target.blockX + block.getBlockBoundsMaxX() + f; EntityDiggingFX fx = new EntityDiggingFX(worldObj, xPos, yPos, zPos, 0.0D, 0.0D, 0.0D, block, worldObj.getBlockMetadata(target.blockX, target.blockY, target.blockZ)); fx.applyColourMultiplier(target.blockX, target.blockY, target.blockZ); fx.multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F); fx.setParticleIcon(block.getIcon(worldObj.rand.nextInt(6), te.composeMetadata(protoBlock, protoMeta))); effectRenderer.addEffect(fx); return true; }
@SideOnly(Side.CLIENT) @Override public boolean addHitEffects (World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) { TileEntityWoodProxy te = getTileEntity(worldObj, target.blockX, target.blockY, target.blockZ); BlockThinLogFence block = getBlock(worldObj, target.blockX, target.blockY, target.blockZ); if (te == null || block == null) return false; int protoMeta = te.getProtoMeta(); Block protoBlock = te.getProtoBlock(); if (protoBlock == null) { protoBlock = Blocks.log; protoMeta = worldObj.getBlockMetadata(target.blockX, target.blockY, target.blockZ); } float f = 0.1F; double xPos = target.blockX + worldObj.rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (f * 2.0F)) + f + block.getBlockBoundsMinX(); double yPos = target.blockY + worldObj.rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (f * 2.0F)) + f + block.getBlockBoundsMinY(); double zPos = target.blockZ + worldObj.rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (f * 2.0F)) + f + block.getBlockBoundsMinZ(); if (target.sideHit == 0) yPos = target.blockY + block.getBlockBoundsMinY() - f; if (target.sideHit == 1) yPos = target.blockY + block.getBlockBoundsMaxY() + f; if (target.sideHit == 2) zPos = target.blockZ + block.getBlockBoundsMinZ() - f; if (target.sideHit == 3) zPos = target.blockZ + block.getBlockBoundsMaxZ() + f; if (target.sideHit == 4) xPos = target.blockX + block.getBlockBoundsMinX() - f; if (target.sideHit == 5) xPos = target.blockX + block.getBlockBoundsMaxX() + f; EntityDiggingFX fx = new EntityDiggingFX(worldObj, xPos, yPos, zPos, 0.0D, 0.0D, 0.0D, block, worldObj.getBlockMetadata(target.blockX, target.blockY, target.blockZ)); fx.applyColourMultiplier(target.blockX, target.blockY, target.blockZ); fx.multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F); fx.setParticleIcon(block.getIcon(worldObj.rand.nextInt(6), te.composeMetadata(protoBlock, protoMeta))); effectRenderer.addEffect(fx); return true; }
@SideOnly(Side.CLIENT) @Override public boolean addDestroyEffects (World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) { TileEntityGarden te = getGardenEntity(world, x, y, z); BlockGarden garden = getGardenBlock(world, x, y, z); if (te == null || garden == null) return true; for (int slot : garden.getSlotProfile().getPlantSlots()) { Block block = getPlantBlock(te, slot); int blockData = getPlantData(te, slot); if (block == null) continue; bindSlot(world, x, y, z, te, slot); try { byte count = 4; for (int ix = 0; ix < count; ++ix) { for (int iy = 0; iy < count; ++iy) { for (int iz = 0; iz < count; ++iz) { double xOff = (double)x + ((double)ix + 0.5D) / (double)count; double yOff = (double)y + ((double)iy + 0.5D) / (double)count; double zOff = (double)z + ((double)iz + 0.5D) / (double)count; EntityDiggingFX fx = new EntityDiggingFX(world, xOff, yOff, zOff, xOff - (double) x - 0.5D, yOff - (double) y - 0.5D, zOff - (double) z - 0.5D, this, meta); fx.setParticleIcon(block.getIcon(world.rand.nextInt(6), blockData)); effectRenderer.addEffect(fx.applyColourMultiplier(x, y, z)); } } } } catch (Exception e) { continue; } finally { unbindSlot(world, x, y, z, te); } } return true; }
protected EntityDiggingFX buildDiggingEffect(World w, double x, double y, double z, double vX, double vY, double vZ, IBlockState blockState) { return (EntityDiggingFX)(new EntityDiggingFX.Factory()).getEntityFX(EnumParticleTypes.BLOCK_CRACK.getParticleID(), w, x, y, z, vX, vY, vZ, Block.getStateId(blockState)); }