Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.src;
- // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
- // Jad home page: http://www.kpdus.com/jad.html
- // Decompiler options: packimports(3) braces deadcode
- import java.util.Random;
- public class _FireworksFX extends EntityFX {
- int type;
- double color;
- double something;
- public _FireworksFX(World world, double d, double d1, double d2,
- double type1, double color1, double something1) {
- super(world, d, d1, d2, 0, 0, 0);
- motionX *= 0.80000001192092896D;
- motionY *= 0.80000001192092896D;
- motionZ *= 0.80000001192092896D;
- motionY = rand.nextFloat() * 0.4F + 0.05F;
- d += (rand.nextFloat() - rand.nextFloat()) * 0.05F;
- d1 += (rand.nextFloat() - rand.nextFloat()) * 0.05F;
- d2 += (rand.nextFloat() - rand.nextFloat()) * 0.05F;
- field_672_a = particleScale;
- renderDistanceWeight = 100D;
- type = (int) type1;
- color = color1;
- something = something1;
- //@Override
- //super isInRangeToRenderDist(100000000);
- double red, green, blue;
- if(color == 0) { // white
- red = 1;
- green = 1;
- blue = 1;
- } else if(color == 1) { // random
- red = Math.random();
- green = Math.random();
- blue = Math.random();
- }
- double change = 1+ (something/300); //something/20 + Math.random()/20;
- //System.out.println(something);
- particleRed = (float) (red*change);
- particleGreen = (float) (green*change);
- particleBlue = (float) (blue*change);
- particleTextureIndex = (int)(Math.random() * 8D);
- if(type == 0) {
- setupSkyrocket(world, d, d1, d2, something);
- } else if(type == 1) {
- setupSubrocket(world, d, d1, d2, something);
- } else if(type == 2) {
- setupSpark(world, d, d1, d2, something);
- }
- }
- {
- /*
- double d1 = boundingBox.getAverageEdgeLength() * 4D;
- d1 *= 64D;
- return d < d1 * d1;
- */
- return true;
- }
- // The type determines what kind of thing it is.
- // They have their own 'constructors'
- // 0 is the skyrocket flying up
- // 1 is one of the clusterthings (Subrocket) shooting in all directions
- // 2 is sparks, left behind by skyrockets and clusterthings
- private void setupSkyrocket(World world, double d, double d1, double d2, double something) {
- motionY = 0.5F;
- particleMaxAge = (int) 10;//(Math.random()*30D);
- noClip = false;
- //motionX = motionX + (Math.random()-05)/10;
- //motionZ = motionZ + (Math.random()-05)/10;
- }
- private void setupSubrocket(World world, double d, double d1, double d2, double something) {
- particleMaxAge = (int) (Math.random()*2+6);
- noClip = false;
- motionX = (Math.random()-0.5)*2;
- motionY = (Math.random()-0.5)*2;
- motionZ = (Math.random()-0.5)*2;
- field_672_a = 0.9F;
- }
- private void setupSpark(World world, double d, double d1, double d2, double something) {
- particleMaxAge = (int)(something/3); //(10D + (Math.random() * 30) +
- noClip = true;
- //int dirX = (Math.random()-0.5)
- motionX = Math.random()/100;
- motionY = Math.random()/100;
- motionZ = Math.random()/100;
- field_672_a = 0.6F + (float) ((Math.random()-0.5)/100);
- super.particleGravity = -1F;
- }
- public void renderParticle(Tessellator tessellator, float f, float f1, float f2, float f3, float f4, float f5) {
- float f6 = ((float)particleAge + f) / (float)particleMaxAge;
- particleScale = field_672_a * (1.0F - f6 * f6 * 0.5F);
- if(type == 0) { // the skyrocket doesn't shrink.
- particleScale = 2;
- }
- super.renderParticle(tessellator, f, f1, f2, f3, f4, f5);
- }
- public float getEntityBrightness(float f) {
- return 1.0F;
- }
- public void onUpdate() {
- something++;
- prevPosX = posX;
- prevPosY = posY;
- prevPosZ = posZ;
- moveEntity(motionX, motionY, motionZ);
- particleRed *= 1.02;
- particleGreen *= 0.999;
- particleBlue *= 1.01;
- if(particleAge++ >= particleMaxAge || posY >= 123 ) {
- if(type == 0) {
- for(int a = 0; a < 100; a++) {
- worldObj.spawnParticle("fireworks", posX, posY, posZ, 1, color, 5);
- }
- System.out.println("KABOEM!");
- worldObj.createExplosion(null, posX, posY, posZ, 0F);
- }
- setEntityDead();
- }
- if(type == 1) {
- worldObj.spawnParticle("fireworks", posX, posY, posZ, 2, color, something);
- double subPosX = prevPosX;
- double subPosY = prevPosY;
- double subPosZ = prevPosZ;
- for(int teller = 1; teller < 11; teller++) {
- //System.out.println(posX-prevPosX);
- subPosX += ((posX-prevPosX)/10);
- subPosY += ((posY-prevPosY)/10);
- subPosZ += ((posZ-prevPosZ)/10);
- worldObj.spawnParticle("fireworks", subPosX, subPosY, subPosZ, 2, color, something);
- something++;
- }
- } else if(type == 0) {
- worldObj.spawnParticle("fireworks", posX, (posY-0.2), posZ, 2, color, 50);
- worldObj.spawnParticle("fireworks", posX, (posY-0.4), posZ, 2, color, 50);
- worldObj.spawnParticle("fireworks", posX, (posY-0.7), posZ, 2, color, 50);
- }
- float f = (float)particleAge / (float)particleMaxAge;
- if(rand.nextFloat() > f) {
- //worldObj.spawnParticle("smoke", posX, posY, posZ, motionX, motionY, motionZ);
- }
- if(!(type == 2)) {
- motionY -= 0.005D;
- }
- if(type == 0) {
- motionY *= 1.15D;
- }
- if(type == 1) {
- motionY -= 0.1;
- }
- motionX *= 0.99900001287460327D;
- motionY *= 0.99900001287460327D;
- motionZ *= 0.99900001287460327D;
- if(onGround) {
- motionY *= -0.7D;
- motionX *= 0.5D;
- motionZ *= 0.5D;
- }
- }
- private float field_672_a;
- }
Advertisement
Add Comment
Please, Sign In to add comment