Пример #1
0
 public void handleBlockItemSwitch(Packet16BlockItemSwitch par1Packet16BlockItemSwitch) {
   if (par1Packet16BlockItemSwitch.id >= 0
       && par1Packet16BlockItemSwitch.id < InventoryPlayer.func_70451_h()) {
     this.playerEntity.inventory.currentItem = par1Packet16BlockItemSwitch.id;
   } else {
     logger.warning(this.playerEntity.username + " tried to set an invalid carried item");
   }
 }
Пример #2
0
 public void func_72502_a(Packet16BlockItemSwitch p_72502_1_) {
   if (p_72502_1_.field_73386_a >= 0
       && p_72502_1_.field_73386_a < InventoryPlayer.func_70451_h()) {
     this.field_72574_e.field_71071_by.field_70461_c = p_72502_1_.field_73386_a;
   } else {
     this.field_72573_d
         .func_98033_al()
         .func_98236_b(
             this.field_72574_e.field_71092_bJ + " tried to set an invalid carried item");
   }
 }
 public void handleBlockItemSwitch(Packet16BlockItemSwitch par1Packet16BlockItemSwitch) {
   if (par1Packet16BlockItemSwitch.id < 0
       || par1Packet16BlockItemSwitch.id >= InventoryPlayer.func_70451_h()) {
     logger.warning(
         (new StringBuilder())
             .append(playerEntity.username)
             .append(" tried to set an invalid carried item")
             .toString());
     return;
   } else {
     playerEntity.inventory.currentItem = par1Packet16BlockItemSwitch.id;
     return;
   }
 }
Пример #4
0
  /** Handle a creative slot packet. */
  public void handleCreativeSetSlot(Packet107CreativeSetSlot par1Packet107CreativeSetSlot) {
    if (this.playerEntity.theItemInWorldManager.isCreative()) {
      boolean var2 = par1Packet107CreativeSetSlot.slot < 0;
      ItemStack var3 = par1Packet107CreativeSetSlot.itemStack;
      boolean var4 =
          par1Packet107CreativeSetSlot.slot >= 1
              && par1Packet107CreativeSetSlot.slot < 36 + InventoryPlayer.func_70451_h();
      boolean var5 =
          var3 == null
              || var3.itemID < Item.itemsList.length
                  && var3.itemID >= 0
                  && Item.itemsList[var3.itemID] != null;
      boolean var6 =
          var3 == null
              || var3.getItemDamage() >= 0
                  && var3.getItemDamage() >= 0
                  && var3.stackSize <= 64
                  && var3.stackSize > 0;

      if (var4 && var5 && var6) {
        if (var3 == null) {
          this.playerEntity.inventorySlots.putStackInSlot(
              par1Packet107CreativeSetSlot.slot, (ItemStack) null);
        } else {
          this.playerEntity.inventorySlots.putStackInSlot(par1Packet107CreativeSetSlot.slot, var3);
        }

        this.playerEntity.inventorySlots.setCanCraft(this.playerEntity, true);
      } else if (var2 && var5 && var6 && this.field_72578_n < 200) {
        this.field_72578_n += 20;
        EntityItem var7 = this.playerEntity.dropPlayerItem(var3);

        if (var7 != null) {
          var7.func_70288_d();
        }
      }
    }
  }
  /** 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();
        }
      }
    }
  }
Пример #6
0
  public void func_72464_a(Packet107CreativeSetSlot p_72464_1_) {
    if (this.field_72574_e.field_71134_c.func_73083_d()) {
      boolean var2 = p_72464_1_.field_73385_a < 0;
      ItemStack var3 = p_72464_1_.field_73384_b;
      boolean var4 =
          p_72464_1_.field_73385_a >= 1
              && p_72464_1_.field_73385_a < 36 + InventoryPlayer.func_70451_h();
      boolean var5 =
          var3 == null
              || var3.field_77993_c < Item.field_77698_e.length
                  && var3.field_77993_c >= 0
                  && Item.field_77698_e[var3.field_77993_c] != null;
      boolean var6 =
          var3 == null
              || var3.func_77960_j() >= 0
                  && var3.func_77960_j() >= 0
                  && var3.field_77994_a <= 64
                  && var3.field_77994_a > 0;
      if (var4 && var5 && var6) {
        if (var3 == null) {
          this.field_72574_e.field_71069_bz.func_75141_a(
              p_72464_1_.field_73385_a, (ItemStack) null);
        } else {
          this.field_72574_e.field_71069_bz.func_75141_a(p_72464_1_.field_73385_a, var3);
        }

        this.field_72574_e.field_71069_bz.func_75128_a(this.field_72574_e, true);
      } else if (var2 && var5 && var6 && this.field_72578_n < 200) {
        this.field_72578_n += 20;
        EntityItem var7 = this.field_72574_e.func_71021_b(var3);
        if (var7 != null) {
          var7.func_70288_d();
        }
      }
    }
  }