public void func_71852_a(
     World p_71852_1_,
     int p_71852_2_,
     int p_71852_3_,
     int p_71852_4_,
     int p_71852_5_,
     int p_71852_6_) {
   TileEntityChest tileentitychest =
       (TileEntityChest) p_71852_1_.func_72796_p(p_71852_2_, p_71852_3_, p_71852_4_);
   if (tileentitychest != null) {
     for (int i = 0; i < tileentitychest.func_70302_i_(); i++) {
       ItemStack itemstack = tileentitychest.func_70301_a(i);
       if (itemstack == null) {
         continue;
       }
       float f = field_72293_a.nextFloat() * 0.8F + 0.1F;
       float f1 = field_72293_a.nextFloat() * 0.8F + 0.1F;
       float f2 = field_72293_a.nextFloat() * 0.8F + 0.1F;
       while (itemstack.field_77994_a > 0) {
         int j = field_72293_a.nextInt(21) + 10;
         if (j > itemstack.field_77994_a) {
           j = itemstack.field_77994_a;
         }
         itemstack.field_77994_a -= j;
         EntityItem entityitem =
             new EntityItem(
                 p_71852_1_,
                 (float) p_71852_2_ + f,
                 (float) p_71852_3_ + f1,
                 (float) p_71852_4_ + f2,
                 new ItemStack(itemstack.field_77993_c, j, itemstack.func_77960_j()));
         float f3 = 0.05F;
         entityitem.field_70159_w = (float) field_72293_a.nextGaussian() * f3;
         entityitem.field_70181_x = (float) field_72293_a.nextGaussian() * f3 + 0.2F;
         entityitem.field_70179_y = (float) field_72293_a.nextGaussian() * f3;
         if (itemstack.func_77942_o()) {
           entityitem.field_70294_a.func_77982_d(
               (NBTTagCompound) itemstack.func_77978_p().func_74737_b());
         }
         p_71852_1_.func_72838_d(entityitem);
       }
     }
   }
   super.func_71852_a(p_71852_1_, p_71852_2_, p_71852_3_, p_71852_4_, p_71852_5_, p_71852_6_);
 }
  /** Handle a creative slot packet. */
  public void handleCreativeSetSlot(Packet107CreativeSetSlot par1Packet107CreativeSetSlot) {
    if (playerEntity.theItemInWorldManager.isCreative()) {
      boolean flag = par1Packet107CreativeSetSlot.slot < 0;
      ItemStack itemstack = par1Packet107CreativeSetSlot.itemStack;
      boolean flag1 =
          par1Packet107CreativeSetSlot.slot >= 1
              && par1Packet107CreativeSetSlot.slot < 36 + InventoryPlayer.func_70451_h();
      boolean flag2 =
          itemstack == null
              || itemstack.itemID < Item.itemsList.length
                  && itemstack.itemID >= 0
                  && Item.itemsList[itemstack.itemID] != null;
      boolean flag3 =
          itemstack == null
              || itemstack.getItemDamage() >= 0
                  && itemstack.getItemDamage() >= 0
                  && itemstack.stackSize <= 64
                  && itemstack.stackSize > 0;

      if (flag1 && flag2 && flag3) {
        if (itemstack == null) {
          playerEntity.inventorySlots.putStackInSlot(par1Packet107CreativeSetSlot.slot, null);
        } else {
          playerEntity.inventorySlots.putStackInSlot(par1Packet107CreativeSetSlot.slot, itemstack);
        }

        playerEntity.inventorySlots.setPlayerIsPresent(playerEntity, true);
      } else if (flag && flag2 && flag3 && creativeItemCreationSpamThresholdTally < 200) {
        creativeItemCreationSpamThresholdTally += 20;
        EntityItem entityitem = playerEntity.dropPlayerItem(itemstack);

        if (entityitem != null) {
          entityitem.func_70288_d();
        }
      }
    }
  }
 public void dropPlayerItemWithRandomChoice(ItemStack itemstack, boolean flag) {
   if (itemstack == null) {
     return;
   }
   EntityItem entityitem =
       new EntityItem(
           worldObj,
           posX,
           (posY - 0.30000001192092896D) + (double) getEyeHeight(),
           posZ,
           itemstack);
   entityitem.delayBeforeCanPickup = 40;
   float f = 0.1F;
   if (flag) {
     float f2 = rand.nextFloat() * 0.5F;
     float f4 = rand.nextFloat() * 3.141593F * 2.0F;
     entityitem.motionX = -MathHelper.sin(f4) * f2;
     entityitem.motionZ = MathHelper.cos(f4) * f2;
     entityitem.motionY = 0.20000000298023224D;
   } else {
     float f1 = 0.3F;
     entityitem.motionX =
         -MathHelper.sin((rotationYaw / 180F) * 3.141593F)
             * MathHelper.cos((rotationPitch / 180F) * 3.141593F)
             * f1;
     entityitem.motionZ =
         MathHelper.cos((rotationYaw / 180F) * 3.141593F)
             * MathHelper.cos((rotationPitch / 180F) * 3.141593F)
             * f1;
     entityitem.motionY = -MathHelper.sin((rotationPitch / 180F) * 3.141593F) * f1 + 0.1F;
     f1 = 0.02F;
     float f3 = rand.nextFloat() * 3.141593F * 2.0F;
     f1 *= rand.nextFloat();
     entityitem.motionX += Math.cos(f3) * (double) f1;
     entityitem.motionY += (rand.nextFloat() - rand.nextFloat()) * 0.1F;
     entityitem.motionZ += Math.sin(f3) * (double) f1;
   }
   joinEntityItemWithWorld(entityitem);
   addStat(StatList.dropStat, 1);
 }