コード例 #1
0
  /**
   * This function stores as many items of an ItemStack as possible in a matching slot and returns
   * the quantity of left over items.
   */
  private int storePartialItemStack(ItemStack par1ItemStack) {
    int var2 = par1ItemStack.itemID;
    int var3 = par1ItemStack.stackSize;
    int var4;

    if (par1ItemStack.getMaxStackSize() == 1) {
      var4 = this.getFirstEmptyStack();

      if (var4 < 0) {
        return var3;
      } else {
        if (this.mainInventory[var4] == null) {
          this.mainInventory[var4] = ItemStack.copyItemStack(par1ItemStack);
        }

        return 0;
      }
    } else {
      var4 = this.storeItemStack(par1ItemStack);

      if (var4 < 0) {
        var4 = this.getFirstEmptyStack();
      }

      if (var4 < 0) {
        return var3;
      } else {
        if (this.mainInventory[var4] == null) {
          this.mainInventory[var4] = new ItemStack(var2, 0, par1ItemStack.getItemDamage());

          if (par1ItemStack.hasTagCompound()) {
            this.mainInventory[var4].setTagCompound(
                (NBTTagCompound) par1ItemStack.getTagCompound().copy());
          }
        }

        int var5 = var3;

        if (var3
            > this.mainInventory[var4].getMaxStackSize() - this.mainInventory[var4].stackSize) {
          var5 = this.mainInventory[var4].getMaxStackSize() - this.mainInventory[var4].stackSize;
        }

        if (var5 > this.getInventoryStackLimit() - this.mainInventory[var4].stackSize) {
          var5 = this.getInventoryStackLimit() - this.mainInventory[var4].stackSize;
        }

        if (var5 == 0) {
          return var3;
        } else {
          var3 -= var5;
          this.mainInventory[var4].stackSize += var5;
          this.mainInventory[var4].animationsToGo = 5;
          return var3;
        }
      }
    }
  }
コード例 #2
0
 /** Return whether the specified armor ItemStack has a color. */
 public boolean hasColor(ItemStack par1ItemStack) {
   return this.material != EnumArmorMaterial.CLOTH
       ? false
       : (!par1ItemStack.hasTagCompound()
           ? false
           : (!par1ItemStack.getTagCompound().hasKey("display")
               ? false
               : par1ItemStack.getTagCompound().getCompoundTag("display").hasKey("color")));
 }
コード例 #3
0
  /** allows items to add custom lines of information to the mouseover description */
  public void addInformation(
      ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
    if (par1ItemStack.hasTagCompound()) {
      NBTTagCompound var5 = par1ItemStack.getTagCompound().getCompoundTag("Explosion");

      if (var5 != null) {
        func_92107_a(var5, par3List);
      }
    }
  }
コード例 #4
0
  public static NBTBase func_92108_a(ItemStack par0ItemStack, String par1Str) {
    if (par0ItemStack.hasTagCompound()) {
      NBTTagCompound var2 = par0ItemStack.getTagCompound().getCompoundTag("Explosion");

      if (var2 != null) {
        return var2.getTag(par1Str);
      }
    }

    return null;
  }
コード例 #5
0
  public String getItemDisplayName(ItemStack par1ItemStack) {
    if (par1ItemStack.hasTagCompound()) {
      NBTTagCompound nbttagcompound = par1ItemStack.getTagCompound();
      NBTTagString nbttagstring = (NBTTagString) nbttagcompound.getTag("title");

      if (nbttagstring != null) {
        return nbttagstring.toString();
      }
    }

    return super.getItemDisplayName(par1ItemStack);
  }
コード例 #6
0
  public void handleHealthUpdate(byte par1) {
    if (par1 == 17 && this.worldObj.isRemote) {
      ItemStack var2 = this.dataWatcher.getWatchableObjectItemStack(8);
      NBTTagCompound var3 = null;

      if (var2 != null && var2.hasTagCompound()) {
        var3 = var2.getTagCompound().getCompoundTag("Fireworks");
      }

      this.worldObj.func_92088_a(
          this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ, var3);
    }

    super.handleHealthUpdate(par1);
  }
コード例 #7
0
ファイル: BlockMachine.java プロジェクト: blued00r/Mekanism
  @Override
  public void breakBlock(World world, int x, int y, int z, int i1, int i2) {
    TileEntityBasicMachine tileEntity = (TileEntityBasicMachine) world.getBlockTileEntity(x, y, z);

    if (tileEntity != null) {
      for (int i = 0; i < tileEntity.getSizeInventory(); ++i) {
        ItemStack slotStack = tileEntity.getStackInSlot(i);

        if (slotStack != null) {
          float xRandom = machineRand.nextFloat() * 0.8F + 0.1F;
          float yRandom = machineRand.nextFloat() * 0.8F + 0.1F;
          float zRandom = machineRand.nextFloat() * 0.8F + 0.1F;

          while (slotStack.stackSize > 0) {
            int j = machineRand.nextInt(21) + 10;

            if (j > slotStack.stackSize) {
              j = slotStack.stackSize;
            }

            slotStack.stackSize -= j;
            EntityItem item =
                new EntityItem(
                    world,
                    (double) ((float) x + xRandom),
                    (double) ((float) y + yRandom),
                    (double) ((float) z + zRandom),
                    new ItemStack(slotStack.itemID, j, slotStack.getItemDamage()));

            if (slotStack.hasTagCompound()) {
              item.item.setTagCompound((NBTTagCompound) slotStack.getTagCompound().copy());
            }

            float k = 0.05F;
            item.motionX = (double) ((float) machineRand.nextGaussian() * k);
            item.motionY = (double) ((float) machineRand.nextGaussian() * k + 0.2F);
            item.motionZ = (double) ((float) machineRand.nextGaussian() * k);
            world.spawnEntityInWorld(item);
          }
        }
      }
      tileEntity.invalidate();
    }

    super.breakBlock(world, x, y, z, i1, i2);
  }
コード例 #8
0
  /** Will get destroyed next tick. */
  public void setDead() {
    if (this.field_82345_h) {
      for (int var1 = 0; var1 < this.getSizeInventory(); ++var1) {
        ItemStack var2 = this.getStackInSlot(var1);

        if (var2 != null) {
          float var3 = this.rand.nextFloat() * 0.8F + 0.1F;
          float var4 = this.rand.nextFloat() * 0.8F + 0.1F;
          float var5 = this.rand.nextFloat() * 0.8F + 0.1F;

          while (var2.stackSize > 0) {
            int var6 = this.rand.nextInt(21) + 10;

            if (var6 > var2.stackSize) {
              var6 = var2.stackSize;
            }

            var2.stackSize -= var6;
            EntityItem var7 =
                new EntityItem(
                    this.worldObj,
                    this.posX + (double) var3,
                    this.posY + (double) var4,
                    this.posZ + (double) var5,
                    new ItemStack(var2.itemID, var6, var2.getItemDamage()));

            if (var2.hasTagCompound()) {
              var7.func_92059_d().setTagCompound((NBTTagCompound) var2.getTagCompound().copy());
            }

            float var8 = 0.05F;
            var7.motionX = (double) ((float) this.rand.nextGaussian() * var8);
            var7.motionY = (double) ((float) this.rand.nextGaussian() * var8 + 0.2F);
            var7.motionZ = (double) ((float) this.rand.nextGaussian() * var8);
            this.worldObj.spawnEntityInWorld(var7);
          }
        }
      }
    }

    super.setDead();

    if (this.field_82344_g != null) {
      this.field_82344_g.update();
    }
  }
コード例 #9
0
  /** Set the enchantments for the specified stack. */
  public static void setEnchantments(Map par0Map, ItemStack par1ItemStack) {
    NBTTagList var2 = new NBTTagList();
    Iterator var3 = par0Map.keySet().iterator();

    while (var3.hasNext()) {
      int var4 = ((Integer) var3.next()).intValue();
      NBTTagCompound var5 = new NBTTagCompound();
      var5.setShort("id", (short) var4);
      var5.setShort("lvl", (short) ((Integer) par0Map.get(Integer.valueOf(var4))).intValue());
      var2.appendTag(var5);
    }

    if (var2.tagCount() > 0) {
      par1ItemStack.setTagInfo("ench", var2);
    } else if (par1ItemStack.hasTagCompound()) {
      par1ItemStack.getTagCompound().removeTag("ench");
    }
  }
コード例 #10
0
  /** allows items to add custom lines of information to the mouseover description */
  public void addInformation(ItemStack par1ItemStack, List par2List) {
    if (par1ItemStack.hasTagCompound()) {
      NBTTagCompound nbttagcompound = par1ItemStack.getTagCompound();
      NBTTagString nbttagstring = (NBTTagString) nbttagcompound.getTag("author");

      if (nbttagstring != null) {
        par2List.add(
            (new StringBuilder())
                .append("\2477")
                .append(
                    String.format(
                        StatCollector.translateToLocalFormatted(
                            "book.byAuthor", new Object[] {nbttagstring.data}),
                        new Object[0]))
                .toString());
      }
    }
  }
コード例 #11
0
  /** ejects contained items into the world, and notifies neighbours of an update, as appropriate */
  public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) {
    TileEntityChest var7 = (TileEntityChest) par1World.getBlockTileEntity(par2, par3, par4);

    if (var7 != null) {
      for (int var8 = 0; var8 < var7.getSizeInventory(); ++var8) {
        ItemStack var9 = var7.getStackInSlot(var8);

        if (var9 != null) {
          float var10 = this.random.nextFloat() * 0.8F + 0.1F;
          float var11 = this.random.nextFloat() * 0.8F + 0.1F;
          EntityItem var14;

          for (float var12 = this.random.nextFloat() * 0.8F + 0.1F;
              var9.stackSize > 0;
              par1World.spawnEntityInWorld(var14)) {
            int var13 = this.random.nextInt(21) + 10;

            if (var13 > var9.stackSize) {
              var13 = var9.stackSize;
            }

            var9.stackSize -= var13;
            var14 =
                new EntityItem(
                    par1World,
                    (double) ((float) par2 + var10),
                    (double) ((float) par3 + var11),
                    (double) ((float) par4 + var12),
                    new ItemStack(var9.itemID, var13, var9.getItemDamage()));
            float var15 = 0.05F;
            var14.motionX = (double) ((float) this.random.nextGaussian() * var15);
            var14.motionY = (double) ((float) this.random.nextGaussian() * var15 + 0.2F);
            var14.motionZ = (double) ((float) this.random.nextGaussian() * var15);

            if (var9.hasTagCompound()) {
              var14.getEntityItem().setTagCompound((NBTTagCompound) var9.getTagCompound().copy());
            }
          }
        }
      }
    }

    super.breakBlock(par1World, par2, par3, par4, par5, par6);
  }
コード例 #12
0
  public EntityFireworkRocket(
      World par1World, double par2, double par4, double par6, ItemStack par8ItemStack) {
    super(par1World);
    this.fireworkAge = 0;
    this.setSize(0.25F, 0.25F);
    this.setPosition(par2, par4, par6);
    this.yOffset = 0.0F;
    int var9 = 1;

    if (par8ItemStack != null && par8ItemStack.hasTagCompound()) {
      this.dataWatcher.updateObject(8, par8ItemStack);
      NBTTagCompound var10 = par8ItemStack.getTagCompound();
      NBTTagCompound var11 = var10.getCompoundTag("Fireworks");

      if (var11 != null) {
        var9 += var11.getByte("Flight");
      }
    }

    this.motionX = this.rand.nextGaussian() * 0.001D;
    this.motionZ = this.rand.nextGaussian() * 0.001D;
    this.motionY = 0.05D;
    this.lifetime = 10 * var9 + this.rand.nextInt(6) + this.rand.nextInt(7);
  }
コード例 #13
0
ファイル: RenderPlayer.java プロジェクト: Hoeze/Spoutcraft
  /** Method for adding special render rules */
  protected void renderSpecials(EntityPlayer par1EntityPlayer, float par2) {
    float var3 = 1.0F;
    GL11.glColor3f(var3, var3, var3);
    super.renderEquippedItems(par1EntityPlayer, par2);
    super.renderArrowsStuckInEntity(par1EntityPlayer, par2);
    ItemStack var4 = par1EntityPlayer.inventory.armorItemInSlot(3);

    if (var4 != null) {
      GL11.glPushMatrix();
      this.modelBipedMain.bipedHead.postRender(0.0625F);
      float var5;

      if (var4.getItem().itemID < 256) {
        if (RenderBlocks.renderItemIn3d(Block.blocksList[var4.itemID].getRenderType())) {
          var5 = 0.625F;
          GL11.glTranslatef(0.0F, -0.25F, 0.0F);
          GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
          GL11.glScalef(var5, -var5, -var5);
        }

        this.renderManager.itemRenderer.renderItem(par1EntityPlayer, var4, 0);
      } else if (var4.getItem().itemID == Item.skull.itemID) {
        var5 = 1.0625F;
        GL11.glScalef(var5, -var5, -var5);
        String var6 = "";

        if (var4.hasTagCompound() && var4.getTagCompound().hasKey("SkullOwner")) {
          var6 = var4.getTagCompound().getString("SkullOwner");
        }

        TileEntitySkullRenderer.skullRenderer.func_82393_a(
            -0.5F, 0.0F, -0.5F, 1, 180.0F, var4.getItemDamage(), var6);
      }

      GL11.glPopMatrix();
    }

    if (!par1EntityPlayer.getHasActivePotion()) {
      AccessoryHandler.renderAllAccessories(par1EntityPlayer, 0.0625F, par2); // Spout
    }

    float var7;
    float var8;

    if (par1EntityPlayer.username.equals("deadmau5")
        && this.loadDownloadableImageTexture(par1EntityPlayer.skinUrl, (String) null)) {
      for (int var20 = 0; var20 < 2; ++var20) {
        float var25 =
            par1EntityPlayer.prevRotationYaw
                + (par1EntityPlayer.rotationYaw - par1EntityPlayer.prevRotationYaw) * par2
                - (par1EntityPlayer.prevRenderYawOffset
                    + (par1EntityPlayer.renderYawOffset - par1EntityPlayer.prevRenderYawOffset)
                        * par2);
        var7 =
            par1EntityPlayer.prevRotationPitch
                + (par1EntityPlayer.rotationPitch - par1EntityPlayer.prevRotationPitch) * par2;
        GL11.glPushMatrix();
        GL11.glRotatef(var25, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(var7, 1.0F, 0.0F, 0.0F);
        GL11.glTranslatef(0.375F * (float) (var20 * 2 - 1), 0.0F, 0.0F);
        GL11.glTranslatef(0.0F, -0.375F, 0.0F);
        GL11.glRotatef(-var7, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(-var25, 0.0F, 1.0F, 0.0F);
        var8 = 1.3333334F;
        GL11.glScalef(var8, var8, var8);
        this.modelBipedMain.renderEars(0.0625F);
        GL11.glPopMatrix();
      }
    }

    float var11;

    if (this.loadDownloadableImageTexture(par1EntityPlayer.playerCloakUrl, (String) null)
        && !par1EntityPlayer.getHasActivePotion()
        && !par1EntityPlayer.getHideCape()) {
      GL11.glPushMatrix();
      GL11.glTranslatef(0.0F, 0.0F, 0.125F);
      double var22 =
          par1EntityPlayer.field_71091_bM
              + (par1EntityPlayer.field_71094_bP - par1EntityPlayer.field_71091_bM) * (double) par2
              - (par1EntityPlayer.prevPosX
                  + (par1EntityPlayer.posX - par1EntityPlayer.prevPosX) * (double) par2);
      double var24 =
          par1EntityPlayer.field_71096_bN
              + (par1EntityPlayer.field_71095_bQ - par1EntityPlayer.field_71096_bN) * (double) par2
              - (par1EntityPlayer.prevPosY
                  + (par1EntityPlayer.posY - par1EntityPlayer.prevPosY) * (double) par2);
      double var9 =
          par1EntityPlayer.field_71097_bO
              + (par1EntityPlayer.field_71085_bR - par1EntityPlayer.field_71097_bO) * (double) par2
              - (par1EntityPlayer.prevPosZ
                  + (par1EntityPlayer.posZ - par1EntityPlayer.prevPosZ) * (double) par2);
      var11 =
          par1EntityPlayer.prevRenderYawOffset
              + (par1EntityPlayer.renderYawOffset - par1EntityPlayer.prevRenderYawOffset) * par2;
      double var12 = (double) MathHelper.sin(var11 * (float) Math.PI / 180.0F);
      double var14 = (double) (-MathHelper.cos(var11 * (float) Math.PI / 180.0F));
      float var16 = (float) var24 * 10.0F;

      if (var16 < -6.0F) {
        var16 = -6.0F;
      }

      if (var16 > 32.0F) {
        var16 = 32.0F;
      }

      float var17 = (float) (var22 * var12 + var9 * var14) * 100.0F;
      float var18 = (float) (var22 * var14 - var9 * var12) * 100.0F;

      if (var17 < 0.0F) {
        var17 = 0.0F;
      }

      float var19 =
          par1EntityPlayer.prevCameraYaw
              + (par1EntityPlayer.cameraYaw - par1EntityPlayer.prevCameraYaw) * par2;
      var16 +=
          MathHelper.sin(
                  (par1EntityPlayer.prevDistanceWalkedModified
                          + (par1EntityPlayer.distanceWalkedModified
                                  - par1EntityPlayer.prevDistanceWalkedModified)
                              * par2)
                      * 6.0F)
              * 32.0F
              * var19;

      if (par1EntityPlayer.isSneaking()) {
        var16 += 25.0F;
      }

      GL11.glRotatef(6.0F + var17 / 2.0F + var16, 1.0F, 0.0F, 0.0F);
      GL11.glRotatef(var18 / 2.0F, 0.0F, 0.0F, 1.0F);
      GL11.glRotatef(-var18 / 2.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
      this.modelBipedMain.renderCloak(0.0625F);
      GL11.glPopMatrix();
    }

    ItemStack var21 = par1EntityPlayer.inventory.getCurrentItem();

    if (var21 != null) {
      GL11.glPushMatrix();
      this.modelBipedMain.bipedRightArm.postRender(0.0625F);
      GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F);

      if (par1EntityPlayer.fishEntity != null) {
        var21 = new ItemStack(Item.stick);
      }

      EnumAction var23 = null;

      if (par1EntityPlayer.getItemInUseCount() > 0) {
        var23 = var21.getItemUseAction();
      }

      if (var21.itemID < 256
          && RenderBlocks.renderItemIn3d(Block.blocksList[var21.itemID].getRenderType())) {
        var7 = 0.5F;
        GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
        var7 *= 0.75F;
        GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(-var7, -var7, var7);
      } else if (var21.itemID == Item.bow.itemID) {
        var7 = 0.625F;
        GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
        GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(var7, -var7, var7);
        GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
        // Spout Start
      } else if (Item.itemsList[var21.itemID].isFull3D()
          || var21.itemID == Item.flint.itemID
              && MaterialData.getCustomItem(var21.getItemDamage())
                  instanceof org.spoutcraft.api.material.Tool) {
        // Spout End
        var7 = 0.625F;

        if (Item.itemsList[var21.itemID].shouldRotateAroundWhenRendering()) {
          GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
          GL11.glTranslatef(0.0F, -0.125F, 0.0F);
        }

        if (par1EntityPlayer.getItemInUseCount() > 0 && var23 == EnumAction.block) {
          GL11.glTranslatef(0.05F, 0.0F, -0.1F);
          GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(-10.0F, 1.0F, 0.0F, 0.0F);
          GL11.glRotatef(-60.0F, 0.0F, 0.0F, 1.0F);
        }

        GL11.glTranslatef(0.0F, 0.1875F, 0.0F);
        GL11.glScalef(var7, -var7, var7);
        GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
      } else {
        var7 = 0.375F;
        GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
        GL11.glScalef(var7, var7, var7);
        GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F);
      }

      float var10;
      int var27;
      float var28;

      if (var21.getItem().requiresMultipleRenderPasses()) {
        for (var27 = 0; var27 <= 1; ++var27) {
          int var26 = var21.getItem().getColorFromItemStack(var21, var27);
          var28 = (float) (var26 >> 16 & 255) / 255.0F;
          var10 = (float) (var26 >> 8 & 255) / 255.0F;
          var11 = (float) (var26 & 255) / 255.0F;
          GL11.glColor4f(var28, var10, var11, 1.0F);
          this.renderManager.itemRenderer.renderItem(par1EntityPlayer, var21, var27);
        }
      } else {
        var27 = var21.getItem().getColorFromItemStack(var21, 0);
        var8 = (float) (var27 >> 16 & 255) / 255.0F;
        var28 = (float) (var27 >> 8 & 255) / 255.0F;
        var10 = (float) (var27 & 255) / 255.0F;
        GL11.glColor4f(var8, var28, var10, 1.0F);
        this.renderManager.itemRenderer.renderItem(par1EntityPlayer, var21, 0);
      }

      GL11.glPopMatrix();
    }
  }
コード例 #14
0
  /** Used to check if a recipe matches current crafting inventory */
  public boolean matches(InventoryCrafting par1InventoryCrafting, World par2World) {
    this.field_92102_a = null;
    int var3 = 0;
    int var4 = 0;
    int var5 = 0;
    int var6 = 0;
    int var7 = 0;
    int var8 = 0;

    for (int var9 = 0; var9 < par1InventoryCrafting.getSizeInventory(); ++var9) {
      ItemStack var10 = par1InventoryCrafting.getStackInSlot(var9);

      if (var10 != null) {
        if (var10.itemID == Item.gunpowder.itemID) {
          ++var4;
        } else if (var10.itemID == Item.fireworkCharge.itemID) {
          ++var6;
        } else if (var10.itemID == Item.dyePowder.itemID) {
          ++var5;
        } else if (var10.itemID == Item.paper.itemID) {
          ++var3;
        } else if (var10.itemID == Item.glowstone.itemID) {
          ++var7;
        } else if (var10.itemID == Item.diamond.itemID) {
          ++var7;
        } else if (var10.itemID == Item.fireballCharge.itemID) {
          ++var8;
        } else if (var10.itemID == Item.feather.itemID) {
          ++var8;
        } else if (var10.itemID == Item.goldNugget.itemID) {
          ++var8;
        } else {
          if (var10.itemID != Item.skull.itemID) {
            return false;
          }

          ++var8;
        }
      }
    }

    var7 += var5 + var8;

    if (var4 <= 3 && var3 <= 1) {
      NBTTagCompound var15;
      NBTTagCompound var18;

      if (var4 >= 1 && var3 == 1 && var7 == 0) {
        this.field_92102_a = new ItemStack(Item.firework);

        if (var6 > 0) {
          var15 = new NBTTagCompound();
          var18 = new NBTTagCompound("Fireworks");
          NBTTagList var25 = new NBTTagList("Explosions");

          for (int var22 = 0; var22 < par1InventoryCrafting.getSizeInventory(); ++var22) {
            ItemStack var26 = par1InventoryCrafting.getStackInSlot(var22);

            if (var26 != null
                && var26.itemID == Item.fireworkCharge.itemID
                && var26.hasTagCompound()
                && var26.getTagCompound().hasKey("Explosion")) {
              var25.appendTag(var26.getTagCompound().getCompoundTag("Explosion"));
            }
          }

          var18.setTag("Explosions", var25);
          var18.setByte("Flight", (byte) var4);
          var15.setTag("Fireworks", var18);
          this.field_92102_a.setTagCompound(var15);
        }

        return true;
      } else if (var4 == 1 && var3 == 0 && var6 == 0 && var5 > 0 && var8 <= 1) {
        this.field_92102_a = new ItemStack(Item.fireworkCharge);
        var15 = new NBTTagCompound();
        var18 = new NBTTagCompound("Explosion");
        byte var21 = 0;
        ArrayList var12 = new ArrayList();

        for (int var13 = 0; var13 < par1InventoryCrafting.getSizeInventory(); ++var13) {
          ItemStack var14 = par1InventoryCrafting.getStackInSlot(var13);

          if (var14 != null) {
            if (var14.itemID == Item.dyePowder.itemID) {
              var12.add(Integer.valueOf(ItemDye.dyeColors[var14.getItemDamage()]));
            } else if (var14.itemID == Item.glowstone.itemID) {
              var18.setBoolean("Flicker", true);
            } else if (var14.itemID == Item.diamond.itemID) {
              var18.setBoolean("Trail", true);
            } else if (var14.itemID == Item.fireballCharge.itemID) {
              var21 = 1;
            } else if (var14.itemID == Item.feather.itemID) {
              var21 = 4;
            } else if (var14.itemID == Item.goldNugget.itemID) {
              var21 = 2;
            } else if (var14.itemID == Item.skull.itemID) {
              var21 = 3;
            }
          }
        }

        int[] var24 = new int[var12.size()];

        for (int var27 = 0; var27 < var24.length; ++var27) {
          var24[var27] = ((Integer) var12.get(var27)).intValue();
        }

        var18.setIntArray("Colors", var24);
        var18.setByte("Type", var21);
        var15.setTag("Explosion", var18);
        this.field_92102_a.setTagCompound(var15);
        return true;
      } else if (var4 == 0 && var3 == 0 && var6 == 1 && var5 > 0 && var5 == var7) {
        ArrayList var16 = new ArrayList();

        for (int var20 = 0; var20 < par1InventoryCrafting.getSizeInventory(); ++var20) {
          ItemStack var11 = par1InventoryCrafting.getStackInSlot(var20);

          if (var11 != null) {
            if (var11.itemID == Item.dyePowder.itemID) {
              var16.add(Integer.valueOf(ItemDye.dyeColors[var11.getItemDamage()]));
            } else if (var11.itemID == Item.fireworkCharge.itemID) {
              this.field_92102_a = var11.copy();
              this.field_92102_a.stackSize = 1;
            }
          }
        }

        int[] var17 = new int[var16.size()];

        for (int var19 = 0; var19 < var17.length; ++var19) {
          var17[var19] = ((Integer) var16.get(var19)).intValue();
        }

        if (this.field_92102_a != null && this.field_92102_a.hasTagCompound()) {
          NBTTagCompound var23 = this.field_92102_a.getTagCompound().getCompoundTag("Explosion");

          if (var23 == null) {
            return false;
          } else {
            var23.setIntArray("FadeColors", var17);
            return true;
          }
        } else {
          return false;
        }
      } else {
        return false;
      }
    } else {
      return false;
    }
  }