@Override @SideOnly(Side.CLIENT) public boolean addHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) { if (worldObj.getBlockMetadata(target.blockX, target.blockY, target.blockZ) == 6) { return true; } TileEntity tileEntity = worldObj.getTileEntity(target.blockX, target.blockY, target.blockZ); if (tileEntity instanceof TileEntityTelepadFake) { BlockVec3 mainBlockPosition = ((TileEntityTelepadFake) tileEntity).mainBlockPosition; if (mainBlockPosition != null) { effectRenderer.addBlockHitEffects(mainBlockPosition.x, mainBlockPosition.y, mainBlockPosition.z, target); } } return super.addHitEffects(worldObj, target, effectRenderer); }
@Override @SideOnly(Side.CLIENT) public boolean addHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) { TileEntity tileEntity = worldObj.getTileEntity(target.blockX, target.blockY, target.blockZ); if (tileEntity instanceof TileEntityMulti) { BlockVec3 mainBlockPosition = ((TileEntityMulti) tileEntity).mainBlockPosition; if (mainBlockPosition != null) { effectRenderer.addBlockHitEffects(mainBlockPosition.x, mainBlockPosition.y, mainBlockPosition.z, target); } } return super.addHitEffects(worldObj, target, effectRenderer); }
public static void addBlockHitEffects(World world, Cuboid6 bounds, int side, IIcon icon, EffectRenderer effectRenderer) { float border = 0.1F; Vector3 diff = bounds.max.copy().subtract(bounds.min).add(-2*border); diff.x*=world.rand.nextDouble(); diff.y*=world.rand.nextDouble(); diff.z*=world.rand.nextDouble(); Vector3 pos = diff.add(bounds.min).add(border); if (side == 0) diff.y = bounds.min.y - border; if (side == 1) diff.y = bounds.max.y + border; if (side == 2) diff.z = bounds.min.z - border; if (side == 3) diff.z = bounds.max.z + border; if (side == 4) diff.x = bounds.min.x - border; if (side == 5) diff.x = bounds.max.x + border; effectRenderer.addEffect( new EntityDigIconFX(world, pos.x, pos.y, pos.z, 0, 0, 0, icon) .multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F)); }
@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; }
@SideOnly(Side.CLIENT) public void spawnBigParticles(int temp, float speed) { EffectRenderer renderer = FMLClientHandler.instance().getClient().effectRenderer; if (this.currentAttackID == 4) { temp *= 2; } for (int i = 0; i < temp; i++) { float f = (this.rand.nextFloat() - 0.5F) * speed; float f1 = (this.rand.nextFloat() - 0.5F) * speed; float f2 = (this.rand.nextFloat() - 0.5F) * speed; boolean flag = i < temp / 2; if (this.currentAttackID != 4) { flag = true; } boolean death = this.currentAttackID != 10; double h = death ? this.height : this.height + 1.0F; double w = death ? this.width : this.width * 1.5F; double tempX = (flag ? this.posX : this.teleX) + (this.rand.nextDouble() - 0.5D) * w; double tempY = (flag ? this.posY : this.teleY) + (this.rand.nextDouble() - 0.5D) * h + (death ? 1.5F : 0.5F); double tempZ = (flag ? this.posZ : this.teleZ) + (this.rand.nextDouble() - 0.5D) * w; renderer.addEffect(new FXEnder(this.worldObj, tempX, tempY, tempZ, f, f1, f2, true)); } }
public EntityFireworkStarterFX(World p_i1208_1_, double p_i1208_2_, double p_i1208_4_, double p_i1208_6_, double p_i1208_8_, double p_i1208_10_, double p_i1208_12_, EffectRenderer p_i1208_14_, NBTTagCompound p_i1208_15_) { super(p_i1208_1_, p_i1208_2_, p_i1208_4_, p_i1208_6_, 0.0D, 0.0D, 0.0D); this.field_70159_w = p_i1208_8_; this.field_70181_x = p_i1208_10_; this.field_70179_y = p_i1208_12_; this.field_92040_ay = p_i1208_14_; this.field_70547_e = 8; if(p_i1208_15_ != null) { this.field_92039_az = p_i1208_15_.func_74761_m("Explosions"); if(this.field_92039_az.func_74745_c() == 0) { this.field_92039_az = null; } else { this.field_70547_e = this.field_92039_az.func_74745_c() * 2 - 1; for(int var16 = 0; var16 < this.field_92039_az.func_74745_c(); ++var16) { NBTTagCompound var17 = (NBTTagCompound)this.field_92039_az.func_74743_b(var16); if(var17.func_74767_n("Flicker")) { this.field_92041_a = true; this.field_70547_e += 15; break; } } } } }
/** * 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 void perform(EffectInstance inst) { double x = ((Number) inst.data[0]).doubleValue(); double y = ((Number) inst.data[1]).doubleValue(); double z = ((Number) inst.data[2]).doubleValue(); double dx = ((Number) inst.data[3]).doubleValue(); double dy = ((Number) inst.data[4]).doubleValue(); double dz = ((Number) inst.data[5]).doubleValue(); EffectRenderer effectRenderer = Minecraft.getMinecraft().effectRenderer; double d = Math.sqrt(dx*dx + dy*dy + dz*dz); for (double i = 0; i < d; i += trailStep) { EntityFX particle = new ParticleDust(Minecraft.getMinecraft().theWorld, x + dx * i/d, y + dy * i/d, z + dz * i/d, 0, 0, 0); effectRenderer.addEffect(particle); } }
@Override @SideOnly(Side.CLIENT) public void perform(Entity entity, Object ... data) { EffectRenderer effectRenderer = Minecraft.getMinecraft().effectRenderer; Random rand = new Random(); for (int i = 0; i < MAX_PARTICLES; i++) { float yaw = (rand.nextFloat()*2.0F - 1.0F) * (float) Math.PI; float pitch = (rand.nextFloat() - 0.5F) * (float) Math.PI; double distance = rand.nextDouble() * 0.3D + 0.2D; double cosYaw = (double) MathHelper.cos(yaw); double sinYaw = (double) MathHelper.sin(yaw); double cosPitch = (double) MathHelper.cos(pitch); double sinPitch = (double) MathHelper.sin(pitch); double rX = -sinYaw*cosPitch * distance; double rZ = cosYaw*cosPitch * distance; double rY = -sinPitch * distance; /*double velX = -sinYaw*cosPitch / (distance) * 0.05D; double velZ = cosYaw*cosPitch / (distance) * 0.05D; double velY = -sinPitch / (distance) * 0.05D;*/ EntityFX particle = new ParticleLifesteal(entity.worldObj, entity.posX + rX, entity.posY - entity.yOffset + 1 + rY, entity.posZ + rZ, distance); effectRenderer.addEffect(particle); } }
@SideOnly(Side.CLIENT) @Override public boolean addHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) { int md = worldObj.getBlockMetadata(target.blockX, target.blockY, target.blockZ); if (md < 6) UtilsFX.infusedStoneSparkle(worldObj, target.blockX, target.blockY, target.blockZ, md + 1); return super.addHitEffects(worldObj, target, effectRenderer); }
@Override @SideOnly(Side.CLIENT) public boolean addDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) { if (world.getBlockMetadata(x, y, z) == 6) { return true; } return super.addDestroyEffects(world, x, y, z, meta, effectRenderer); }
@SideOnly(Side.CLIENT) private void emitParticles() { int particleLevel = Minecraft.getMinecraft().gameSettings.particleSetting; if (particleLevel >= 2) return; double r = 7.0 / 16.0; double v = getVelocity(EnumFacing.UP) * r; double bottom = -3.0 / 16.0; double left = -4.0 / 16.0; double scootch_x = 3.0 / 16.0; double scootch_y = 3.0 / 16.0; Quaternion rot = Quaternion.getRotationQuaternionRadians(angle, EnumFacing.UP); double motFuzz = v / 20; Random rng = worldObj.rand; double threshold = velocity / (particleLevel == 1 ? 1 : 4); EffectRenderer effectRenderer = Minecraft.getMinecraft().effectRenderer; for (int side = 0; side < 4; side++) { for (int y = 0; y < 3; y++) { if (rng.nextFloat() > threshold) continue; Vec3 pos = new Vec3(left + scootch_x * y, bottom + scootch_y * y, r); Vec3 mot = new Vec3(-v + rng.nextGaussian() * motFuzz * 3, rng.nextGaussian() * motFuzz, rng.nextGaussian() * motFuzz + r * 0.125); rot.applyRotation(pos); rot.applyRotation(mot); EntityFXSteam steam = new EntityFXSteam(worldObj, pos.xCoord + 0.5 + pos.xCoord, pos.yCoord + 0.5 + pos.yCoord, pos.zCoord + 0.5 + pos.zCoord); SpaceUtil.toEntVel(steam, mot); effectRenderer.addEffect(steam); } rot.incrMultiply(Quaternion.getRotationQuaternionRadians(Math.PI / 2, EnumFacing.UP)); } }
@SideOnly(Side.CLIENT) void spawnParticles() { final double r = 0.5; EffectRenderer effectRenderer = Minecraft.getMinecraft().effectRenderer; for (double dy = 0; dy < height; dy += r) { EntityFXSteam particle = new EntityFXSteam(worldObj, posX, posY + dy, posZ); particle.motionX = rand.nextGaussian() / 16; particle.motionY = 0.3 + Math.abs(rand.nextGaussian()) / 16; particle.motionZ = rand.nextGaussian() / 16; effectRenderer.addEffect(particle); } }
public WorldView(WorldClient worldObj, ChunkCoordinates coords, int width, int height) { this.width = width; this.height = height; this.worldObj = worldObj; this.coords = coords; this.camera = new EntityCamera(worldObj, coords); this.camerawrapper = new ViewCameraImpl(camera); this.renderGlobal = new RenderGlobal(Minecraft.getMinecraft()); this.effectRenderer = new EffectRenderer(worldObj, Minecraft.getMinecraft().getTextureManager()); // Technically speaking, this is poor practice as it leaks a reference to the view before it's done constructing. this.fbo = FrameBufferContainer.createNewFramebuffer(this, width, height); }
@Override @SideOnly(Side.CLIENT) public boolean addDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) { if (world.getBlock(x, y, z) instanceof BlockForceLeaves) { ClientProxy.addBlockEffects(world, x, y, z, effectRenderer, rng); return true; } return super.addDestroyEffects(world, x, y, z, meta, effectRenderer); }
@Override @SideOnly(Side.CLIENT) public boolean addHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) { Double[] coords = getOffsetCoordsForSide(target.blockX+.5, target.blockY+.5, target.blockZ+.5, target.sideHit); effectRenderer.addEffect(new BreakEffect(worldObj, coords[0], coords[1], coords[2], rng.nextGaussian(), rng.nextGaussian(), rng.nextGaussian())); return true; }
@Override @SideOnly(Side.CLIENT) public boolean addDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) { if (world.getBlock(x, y, z) instanceof BlockDC) { ClientProxy.addBlockEffects(world, x, y, z, effectRenderer, rng); return true; } return super.addDestroyEffects(world, x, y, z, meta, effectRenderer); }
@Override @SideOnly(Side.CLIENT) public boolean addDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) { if (world.getBlock(x, y, z) instanceof BlockForceLog) { ClientProxy.addBlockEffects(world, x, y, z, effectRenderer, rng); return true; } return super.addDestroyEffects(world, x, y, z, meta, effectRenderer); }
@Override @SideOnly(Side.CLIENT) public boolean addDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) { if (world.getBlock(x, y, z) instanceof BlockForceSapling) { ClientProxy.addBlockEffects(world, x, y, z, effectRenderer, rng); return true; } return super.addDestroyEffects(world, x, y, z, meta, effectRenderer); }
public static ResourceLocation getParticleTexture() { try { return (ResourceLocation) ReflectionHelper.getPrivateValue(EffectRenderer.class, null, new String[] {"particleTextures","b","field_110737_b"});} catch (Exception e) { } return null; }
public static void AAFillParticles(World worldObj, int xCoord, int yCoord, int zCoord) { boolean PARTICLES_ALLOWED = Configurations.ENABLE_WATER_GEN_PARTICLES; int WATER_GEN = Configurations.WATER_GEN_PER_TICK; if (!PARTICLES_ALLOWED || !(worldObj.isRemote)) { return; } EffectRenderer renderer = Minecraft.getMinecraft().effectRenderer; double theta; double radius; double baseSpeed = 0.01; double random; double baseLife = 25; EntityFX fluidOrb; double d1; double d2; for (int i=0;i<=((int)((double)WATER_GEN/5.0));i++) { theta = MathHelper.randomRad(); radius = MathHelper.randomDoubleBetween(0.05,0.45); random = MathHelper.randomDoubleBetween(0.75,1.0); d1 = radius*Math.sin(theta); d2 = radius*Math.cos(theta); fluidOrb = new ParticleFluidOrb(worldObj,xCoord+0.5+d1,yCoord,zCoord+0.5+d2,-d1*random/baseLife,baseSpeed*random,-d2*random/baseLife,waterFluid,0,((int)(baseLife/random))); renderer.addEffect(fluidOrb); } }
public static void AATransferParticles(World worldObj,int xCoord, int yCoord, int zCoord, int x, int y, int z, int transferred) { boolean PARTICLES_ALLOWED = Configurations.ENABLE_WATER_GEN_PARTICLES; if (!PARTICLES_ALLOWED || !(worldObj.isRemote)) { return; } // LogHelper.info("Inside transferParticles"); EffectRenderer renderer = Minecraft.getMinecraft().effectRenderer; EntityFX fluidOrb;// = new ParticleFluidOrbArc(worldObj,this.xCoord+0.5,this.yCoord+0.51,this.zCoord+0.5,x+0.5,y+0.5,z+0.5,waterFluid,10); // renderer.addEffect(fluidOrb); int baseLife = 10; int lifeRandomizer; double xRand; double zRand; int numParticles = Math.max(1, (int) ((double) transferred / 250)); for (int i=0;i<numParticles;i++) { lifeRandomizer = MathHelper.randomIntInclusiveBetween(-1,1); xRand = MathHelper.randomDoubleBetween(0.45,0.55); zRand = MathHelper.randomDoubleBetween(0.45,0.55); fluidOrb = new ParticleFluidOrbArc(worldObj,xCoord+xRand,yCoord+0.51,zCoord+zRand,x+0.5,y+0.5,z+0.5,waterFluid,baseLife+lifeRandomizer); renderer.addEffect(fluidOrb); } }
@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 addBlockHitEffects(World world, Cuboid6 bounds, int side, IIcon icon, EffectRenderer effectRenderer) { float border = 0.1F; Vector3 diff = bounds.max.copy().subtract(bounds.min).add(-2 * border); diff.x *= world.rand.nextDouble(); diff.y *= world.rand.nextDouble(); diff.z *= world.rand.nextDouble(); Vector3 pos = diff.add(bounds.min).add(border); if (side == 0) { diff.y = bounds.min.y - border; } if (side == 1) { diff.y = bounds.max.y + border; } if (side == 2) { diff.z = bounds.min.z - border; } if (side == 3) { diff.z = bounds.max.z + border; } if (side == 4) { diff.x = bounds.min.x - border; } if (side == 5) { diff.x = bounds.max.x + border; } effectRenderer.addEffect( new EntityDigIconFX(world, pos.x, pos.y, pos.z, 0, 0, 0, icon) .multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F)); }
@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 ResourceLocation getParticleTexture() { try { return (ResourceLocation) ReflectionHelper.getPrivateValue(EffectRenderer.class, null, "particleTextures", "b", "field_110737_b"); } catch (Exception e) { DPLogger.warning("Could not load particleTextures"); e.printStackTrace(); } return null; }
@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; }
public static ResourceLocation getParticleTexture() { try { return (ResourceLocation) ReflectionHelper.getPrivateValue(EffectRenderer.class, null, "particleTextures", "b", "field_110737_b"); } catch (Exception e) {} return null; }
@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; }
/** Updates the cyclone swirling angles and spawns a new ring of particles. */ @SideOnly(Side.CLIENT) private void spawnParticleRing() { yaw += yawVelocity; if (yaw > 2*Math.PI) yaw -= 2*Math.PI; if (Math.random() < 0.1) { pitchVelocity = 0.2f; } pitch += pitchVelocity; if (pitch > maxPitch) pitch = maxPitch; if (pitchVelocity > 0) { pitchVelocity -= 0.05f; } else { pitchVelocity = 0; } if (pitch > 0) { pitch -= 0.07f; } else { pitch = 0; } //TODO: when destroying the cyclone, set the particles to start fading EffectRenderer effectRenderer = Minecraft.getMinecraft().effectRenderer; FXCycloneRing ring = new FXCycloneRing(worldObj, posX, posY + 0.1D, posZ, motionX, motionY, motionZ, yaw, pitch, 0.7f, effectRenderer); effectRenderer.addEffect(ring); }
@Override public void init() { AntiqueAtlasHelper.registerTextures(); Object o = ReflectionHelper.getPrivateValue(EffectRenderer.class, Minecraft.getMinecraft().effectRenderer, 6); if (o instanceof Map) { particleFactoryMap = (Map<Integer, IParticleFactory>) o; } }
public FXCycloneRing(World world, double x, double y, double z, double velX, double velY, double velZ, float yaw, float pitch, float alpha, EffectRenderer renderer) { super(world, x, y, z); // Because the EntityFX constructor with velocities screws them up: motionX = velX; motionY = velY; motionZ = velZ; axis = new Vec3(0, 1, 0); particleGravity = 0; this.yaw = yaw; this.pitch = pitch; axis = axis.rotatePitch(pitch); axis = axis.rotateYaw(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;// Minus 1 to get the block beneath this entity int zInt = MathHelper.floor_double(z); IBlockState state = world.getBlockState(new BlockPos(xInt, yInt, zInt)); if (state.getBlock() != Blocks.air) { // 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] = factory.getEntityFX(EnumParticleTypes.BLOCK_CRACK.getParticleID(), world, x, y + 0.1, z, velX, velY, velZ, Block.getStateId(state)).multipleParticleScaleBy(0.5f); renderer.addEffect(puffs[i]); continue; } } puffs[i] = new ParticleCyclone(world, x, y, z, velX, velY, velZ); puffs[i].setAlphaF(particleAlpha); renderer.addEffect(puffs[i]); } dAngle = 2 * (float)Math.PI / ((float) puffs.length); }
@Override @SideOnly(Side.CLIENT) public boolean addHitEffects(World world, MovingObjectPosition target, EffectRenderer effectRenderer) { int x = target.blockX; int y = target.blockY; int z = target.blockZ; return MBUtilClient.addBlockHitEffects(world, target, effectRenderer, getMetadata(world, x, y, z)); }