public static void createShaped(ParticleFirework.Starter starter, String str, double speed, int[] colours, int[] fadeColours, boolean trail, boolean twinkle) { double shape[][] = stringToDoubleArrayShape(str); if (shape.length == 0) return; double fx = shape[0][0]; double fy = shape[0][1]; starter.createParticle(starter.posX, starter.posY, starter.posZ, fx * speed, fy * speed, 0.0D, colours, fadeColours, trail, twinkle); float f = starter.rand.nextFloat() * (float) Math.PI; double d = f + Math.PI; for (int s = 1; s < shape.length; s++) { double nx = shape[s][0]; double ny = shape[s][1]; double rx = nx * speed; double ry = ny * speed; double sinx = rx * Math.sin(d); rx = rx * Math.cos(d); starter.createParticle(starter.posX, starter.posY, starter.posZ, rx * -1, ry, sinx * -1, colours, fadeColours, trail, twinkle); starter.createParticle(starter.posX, starter.posY, starter.posZ, rx, ry, sinx, colours, fadeColours, trail, twinkle); } }
@SideOnly(Side.CLIENT) private void doEffect() { SoundEvent se = SoundEvents.ENTITY_FIREWORK_LARGE_BLAST; if (ticksExisted > 40) { se = SoundEvents.ENTITY_FIREWORK_LARGE_BLAST_FAR; } world.playSound(this.posX, this.posY, this.posZ, se, SoundCategory.BLOCKS, 20.0F, 0.95F + this.rand.nextFloat() * 0.1F, true); double d1 = this.posX; double d2 = this.posY; double d3 = this.posZ; int size = 5; double speed = 1; for (int j = -size; j <= size; ++j) { for (int k = -size; k <= size; ++k) { for (int l = -size; l <= size; ++l) { double d4 = k + (this.rand.nextDouble() - this.rand.nextDouble()) * 0.5D; double d5 = j + (this.rand.nextDouble() - this.rand.nextDouble()) * 0.5D; double d6 = l + (this.rand.nextDouble() - this.rand.nextDouble()) * 0.5D; double d7 = MathHelper.sqrt(d4 * d4 + d5 * d5 + d6 * d6) / speed + this.rand.nextGaussian() * 0.05D; ParticleFirework.Spark entityfireworksparkfx = new ParticleFirework.Spark(this.world, d1, d2, d3, d4 / d7, d5 / d7, d6 / d7, Minecraft.getMinecraft().effectRenderer); entityfireworksparkfx.setTrail(true); entityfireworksparkfx.setTwinkle(false); entityfireworksparkfx.setColor(WeatherTask.values()[dataManager.get(DATA_ID)].color.getRGB()); Minecraft.getMinecraft().effectRenderer.addEffect(entityfireworksparkfx); if (j != -size && j != size && k != -size && k != size) { l += size * 2 - 1; } } } } }
public void makeFireworks(double x, double y, double z, double motionX, double motionY, double motionZ, @Nullable NBTTagCompound compund) { this.mc.effectRenderer.addEffect(new ParticleFirework.Starter(this, x, y, z, motionX, motionY, motionZ, this.mc.effectRenderer, compund)); }