コード例 #1
0
  @Override
  public void markDirty() {
    EntityPlayer player = parent.get();
    TPlayerStats stats = TPlayerStats.get(player);
    // recalculateSkills(player, stats);
    recalculateHealth(player, stats);

    /*
     * if (inventory[2] == null && stats.knapsack != null) {
     * stats.knapsack.unequipItems(); }
     */
  }
コード例 #2
0
  @Override
  public void setInventorySlotContents(int slot, ItemStack itemstack) {
    inventory[slot] = itemstack;
    // TConstruct.logger.info("Changed slot " + slot + " on side " +
    // FMLCommonHandler.instance().getEffectiveSide());
    if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) {
      itemstack.stackSize = getInventoryStackLimit();
    }

    EntityPlayer player = parent.get();
    TPlayerStats stats = TPlayerStats.get(player);
    recalculateHealth(player, stats);
  }
コード例 #3
0
 @Override
 public ItemStack decrStackSize(int slot, int quantity) {
   if (inventory[slot] != null) {
     // TConstruct.logger.info("Took something from slot " + slot);
     if (inventory[slot].stackSize <= quantity) {
       ItemStack stack = inventory[slot];
       inventory[slot] = null;
       return stack;
     }
     ItemStack split = inventory[slot].splitStack(quantity);
     if (inventory[slot].stackSize == 0) {
       inventory[slot] = null;
     }
     EntityPlayer player = parent.get();
     TPlayerStats stats = TPlayerStats.get(player);
     recalculateHealth(player, stats);
     return split;
   } else {
     return null;
   }
 }