public static void doSmokeEffects(World world, int x, int y, int z, float size) { int count = world.rand.nextInt(6) + 2; for (int i = 0; i < count; i++) { Minecraft.getMinecraft().effectRenderer.addEffect( new EntitySmokeFX(world, x + 0.5 + randEffectOffset(world.rand), y + 0.5 + randEffectOffset(world.rand), z + 0.5 + randEffectOffset(world.rand), randEffectOffset(world.rand) * 0.01F, randEffectOffset(world.rand) * 0.1F, randEffectOffset(world.rand) * 0.01F, size)); } }
@SideOnly(Side.CLIENT) private void doTheThing(double x, double y, double z, double radius, int xzquality, int rarity, int element){ Random r = new Random(); for(int t = 0; t < 360; t++){ if((t % xzquality == 0) && (r.nextInt(rarity) == 0)){ double spawnX = x + (radius * Math.cos(Math.toRadians(t))); double spawnY = y; double spawnZ = z + (radius * Math.sin(Math.toRadians(t))); if(element == 0){ if(r.nextInt(2) == 0){ Minecraft.getMinecraft().effectRenderer.addEffect(new EntityCloudFX(Minecraft.getMinecraft().theWorld, spawnX, spawnY, spawnZ, 0, 0, 0)); } else{ Minecraft.getMinecraft().effectRenderer.addEffect(new EntitySmokeFX(Minecraft.getMinecraft().theWorld, spawnX, spawnY, spawnZ, 0, 0, 0)); } } if(element == 1){ if(r.nextInt(7) == 0){ Minecraft.getMinecraft().effectRenderer.addEffect(new EntityAvatarBubbleFX(Minecraft.getMinecraft().theWorld, spawnX, spawnY, spawnZ, 0, 0, 0)); } else{ Minecraft.getMinecraft().effectRenderer.addEffect(new EntitySplashFX(Minecraft.getMinecraft().theWorld, spawnX, spawnY, spawnZ, 0, 0, 0)); } } if(element == 2) Minecraft.getMinecraft().effectRenderer.addEffect(new EntityFlameFX(Minecraft.getMinecraft().theWorld, spawnX, spawnY, spawnZ, 0, 0, 0)); } } }
private void addRainParticles() { float f = this.mc.theWorld.getRainStrength(1.0F); if (!this.mc.gameSettings.fancyGraphics) { f /= 2.0F; } if (f != 0.0F) { this.random.setSeed(this.rendererUpdateCount * 312987231L); EntityLivingBase entitylivingbase = this.mc.renderViewEntity; WorldClient worldclient = this.mc.theWorld; int i = MathHelper.floor_double(entitylivingbase.posX); int j = MathHelper.floor_double(entitylivingbase.posY); int k = MathHelper.floor_double(entitylivingbase.posZ); byte b0 = 10; double d0 = 0.0D; double d1 = 0.0D; double d2 = 0.0D; int l = 0; int i1 = (int)(100.0F * f * f); if (this.mc.gameSettings.particleSetting == 1) { i1 >>= 1; } else if (this.mc.gameSettings.particleSetting == 2) { i1 = 0; } for (int j1 = 0; j1 < i1; j1++) { int k1 = i + this.random.nextInt(b0) - this.random.nextInt(b0); int l1 = k + this.random.nextInt(b0) - this.random.nextInt(b0); int i2 = worldclient.getPrecipitationHeight(k1, l1); Block block = worldclient.getBlock(k1, i2 - 1, l1); BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(k1, l1); if ((i2 <= j + b0) && (i2 >= j - b0) && (biomegenbase.canSpawnLightningBolt()) && (biomegenbase.getFloatTemperature(k1, i2, l1) >= 0.15F)) { float f1 = this.random.nextFloat(); float f2 = this.random.nextFloat(); if (block.getMaterial() == Material.lava) { this.mc.effectRenderer.addEffect(new EntitySmokeFX(worldclient, k1 + f1, i2 + 0.1F - block.getBlockBoundsMinY(), l1 + f2, 0.0D, 0.0D, 0.0D)); } else if (block.getMaterial() != Material.air) { l++; if (this.random.nextInt(l) == 0) { d0 = k1 + f1; d1 = i2 + 0.1F - block.getBlockBoundsMinY(); d2 = l1 + f2; } this.mc.effectRenderer.addEffect(new EntityRainFX(worldclient, k1 + f1, i2 + 0.1F - block.getBlockBoundsMinY(), l1 + f2)); } } } if ((l > 0) && (this.random.nextInt(3) < this.rainSoundCounter++)) { this.rainSoundCounter = 0; if ((d1 > entitylivingbase.posY + 1.0D) && (worldclient.getPrecipitationHeight(MathHelper.floor_double(entitylivingbase.posX), MathHelper.floor_double(entitylivingbase.posZ)) > MathHelper.floor_double(entitylivingbase.posY))) { this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.1F, 0.5F, false); } else { this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.2F, 1.0F, false); } } } }
@Override public void spawnSmoke(double x, double y, double z, double motionX, double motionY, double motionZ) { EntitySmokeFX fx = new EntitySmokeFX(mc.theWorld, x, y, z, motionX, motionY, motionZ); mc.effectRenderer.addEffect(fx); }
private void addRainParticles() { float f = this.mc.theWorld.getRainStrength(1.0F); if (!this.mc.gameSettings.fancyGraphics) { f /= 2.0F; } if (f != 0.0F) { this.random.setSeed((long)this.rendererUpdateCount * 312987231L); EntityLivingBase entitylivingbase = this.mc.renderViewEntity; WorldClient worldclient = this.mc.theWorld; int i = MathHelper.floor_double(entitylivingbase.posX); int j = MathHelper.floor_double(entitylivingbase.posY); int k = MathHelper.floor_double(entitylivingbase.posZ); byte b0 = 10; double d0 = 0.0D; double d1 = 0.0D; double d2 = 0.0D; int l = 0; int i1 = (int)(100.0F * f * f); if (this.mc.gameSettings.particleSetting == 1) { i1 >>= 1; } else if (this.mc.gameSettings.particleSetting == 2) { i1 = 0; } for (int j1 = 0; j1 < i1; ++j1) { int k1 = i + this.random.nextInt(b0) - this.random.nextInt(b0); int l1 = k + this.random.nextInt(b0) - this.random.nextInt(b0); int i2 = worldclient.getPrecipitationHeight(k1, l1); Block block = worldclient.getBlock(k1, i2 - 1, l1); BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(k1, l1); if (i2 <= j + b0 && i2 >= j - b0 && biomegenbase.canSpawnLightningBolt() && biomegenbase.getFloatTemperature(k1, i2, l1) >= 0.15F) { float f1 = this.random.nextFloat(); float f2 = this.random.nextFloat(); if (block.getMaterial() == Material.lava) { this.mc.effectRenderer.addEffect(new EntitySmokeFX(worldclient, (double)((float)k1 + f1), (double)((float)i2 + 0.1F) - block.getBlockBoundsMinY(), (double)((float)l1 + f2), 0.0D, 0.0D, 0.0D)); } else if (block.getMaterial() != Material.air) { ++l; if (this.random.nextInt(l) == 0) { d0 = (double)((float)k1 + f1); d1 = (double)((float)i2 + 0.1F) - block.getBlockBoundsMinY(); d2 = (double)((float)l1 + f2); } this.mc.effectRenderer.addEffect(new EntityRainFX(worldclient, (double)((float)k1 + f1), (double)((float)i2 + 0.1F) - block.getBlockBoundsMinY(), (double)((float)l1 + f2))); } } } if (l > 0 && this.random.nextInt(3) < this.rainSoundCounter++) { this.rainSoundCounter = 0; if (d1 > entitylivingbase.posY + 1.0D && worldclient.getPrecipitationHeight(MathHelper.floor_double(entitylivingbase.posX), MathHelper.floor_double(entitylivingbase.posZ)) > MathHelper.floor_double(entitylivingbase.posY)) { this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.1F, 0.5F, false); } else { this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.2F, 1.0F, false); } } } }
@SideOnly(Side.CLIENT) public void processPacket(FMLProxyPacket packet){ int l = packet.payload().readInt(); byte[] name = new byte[l]; packet.payload().readBytes(name); String type = new String(name); if(type.equals("ContinueSound")){ int soundNameLength = packet.payload().readInt(); byte[] soundName = new byte[soundNameLength]; packet.payload().readBytes(soundName); String sound = new String(soundName); int entIdLength = packet.payload().readInt(); byte[] entId = new byte[entIdLength]; packet.payload().readBytes(entId); String entityId = new String(entId); boolean play = packet.payload().readBoolean(); if(entity == null){ for(Object o : Minecraft.getMinecraft().theWorld.loadedEntityList){ Entity e = (Entity) o; if(e.getUniqueID().toString().equals(entityId)){ entity = e; } } } soundEffect = new MovingSoundEffect(entity, sound); if(!play){ Minecraft.getMinecraft().getSoundHandler().stopSound(soundEffect); Minecraft.getMinecraft().getSoundHandler().stopSounds(); } else { Minecraft.getMinecraft().getSoundHandler().playSound(soundEffect); } } else if(type.equals("FireLightning")){ double x = packet.payload().readDouble(); double y = packet.payload().readDouble(); double z = packet.payload().readDouble(); for(int i = 0; i < 25; i++){ double xr = rand.nextGaussian() * 2; double yr = rand.nextGaussian() * 2; double zr = rand.nextGaussian() * 2; Minecraft.getMinecraft().effectRenderer.addEffect(new EntitySmokeFX(Minecraft.getMinecraft().theWorld, x + xr, y + yr, z + zr, 0, 0, 0)); } } else if(type.equals("AirTornado")){ int entlen = packet.payload().readInt(); byte[] entname = new byte[entlen]; packet.payload().readBytes(entname); String entnamestr = new String(entname); double lx = packet.payload().readDouble(); double ly = packet.payload().readDouble(); double lz = packet.payload().readDouble(); double dx = packet.payload().readDouble(); double dy = packet.payload().readDouble(); double dz = packet.payload().readDouble(); int height = packet.payload().readInt(); int radius = packet.payload().readInt(); float speed = packet.payload().readFloat(); float slant = packet.payload().readFloat(); long lifetime = packet.payload().readLong(); int animspeed = packet.payload().readInt(); long cooldown = packet.payload().readLong(); Ability.clientInstances.add(new AirTornado(null, cooldown, new Location(Minecraft.getMinecraft().theWorld, lx, ly, lz), new Vector(dx, dy, dz), height, radius, speed, slant, lifetime, animspeed)); } }
private void func_78484_h() { float var1 = this.field_78531_r.field_71441_e.func_72867_j(1.0F); if(!this.field_78531_r.field_71474_y.field_74347_j) { var1 /= 2.0F; } if(var1 != 0.0F) { this.field_78537_ab.setSeed((long)this.field_78529_t * 312987231L); EntityLivingBase var2 = this.field_78531_r.field_71451_h; WorldClient var3 = this.field_78531_r.field_71441_e; int var4 = MathHelper.func_76128_c(var2.field_70165_t); int var5 = MathHelper.func_76128_c(var2.field_70163_u); int var6 = MathHelper.func_76128_c(var2.field_70161_v); byte var7 = 10; double var8 = 0.0D; double var10 = 0.0D; double var12 = 0.0D; int var14 = 0; int var15 = (int)(100.0F * var1 * var1); if(this.field_78531_r.field_71474_y.field_74362_aa == 1) { var15 >>= 1; } else if(this.field_78531_r.field_71474_y.field_74362_aa == 2) { var15 = 0; } for(int var16 = 0; var16 < var15; ++var16) { int var17 = var4 + this.field_78537_ab.nextInt(var7) - this.field_78537_ab.nextInt(var7); int var18 = var6 + this.field_78537_ab.nextInt(var7) - this.field_78537_ab.nextInt(var7); int var19 = var3.func_72874_g(var17, var18); int var20 = var3.func_72798_a(var17, var19 - 1, var18); BiomeGenBase var21 = var3.func_72807_a(var17, var18); if(var19 <= var5 + var7 && var19 >= var5 - var7 && var21.func_76738_d() && var21.func_76743_j() >= 0.2F) { float var22 = this.field_78537_ab.nextFloat(); float var23 = this.field_78537_ab.nextFloat(); if(var20 > 0) { if(Block.field_71973_m[var20].field_72018_cp == Material.field_76256_h) { this.field_78531_r.field_71452_i.func_78873_a(new EntitySmokeFX(var3, (double)((float)var17 + var22), (double)((float)var19 + 0.1F) - Block.field_71973_m[var20].func_83008_x(), (double)((float)var18 + var23), 0.0D, 0.0D, 0.0D)); } else { ++var14; if(this.field_78537_ab.nextInt(var14) == 0) { var8 = (double)((float)var17 + var22); var10 = (double)((float)var19 + 0.1F) - Block.field_71973_m[var20].func_83008_x(); var12 = (double)((float)var18 + var23); } this.field_78531_r.field_71452_i.func_78873_a(new EntityRainFX(var3, (double)((float)var17 + var22), (double)((float)var19 + 0.1F) - Block.field_71973_m[var20].func_83008_x(), (double)((float)var18 + var23))); } } } } if(var14 > 0 && this.field_78537_ab.nextInt(3) < this.field_78534_ac++) { this.field_78534_ac = 0; if(var10 > var2.field_70163_u + 1.0D && var3.func_72874_g(MathHelper.func_76128_c(var2.field_70165_t), MathHelper.func_76128_c(var2.field_70161_v)) > MathHelper.func_76128_c(var2.field_70163_u)) { this.field_78531_r.field_71441_e.func_72980_b(var8, var10, var12, "ambient.weather.rain", 0.1F, 0.5F, false); } else { this.field_78531_r.field_71441_e.func_72980_b(var8, var10, var12, "ambient.weather.rain", 0.2F, 1.0F, false); } } } }