@Override public IInventory getBaublesInventory(EntityPlayer player) { return BaublesApi.getBaubles(player); }
private IInventory getBaublesInvUnsafe(EntityPlayer player) { return BaublesApi.getBaubles(player); }
/** * @param player The player whose inventory to look in * @param item The item to look for * @return Whether the player is currently wearing the provided bauble. */ public static boolean checkForUpgrade(EntityPlayer player, Item item) { IInventory inventory = BaublesApi.getBaubles(player); return ItemStackUtility.inventoryHasItem(inventory, item); } }
@Optional.Method(modid = Reference.MOD_BAUBLES) private void equipBauble(ItemStack itemStack, EntityPlayer player) { IInventory inventory = BaublesApi.getBaubles(player); for(int i = 0; i < inventory.getSizeInventory(); i++) { if(inventory.getStackInSlot(i) == null && inventory.isItemValidForSlot(i, itemStack)) { inventory.setInventorySlotContents(i, itemStack.copy()); if(!player.capabilities.isCreativeMode){ player.inventory.setInventorySlotContents(player.inventory.currentItem, null); } onEquipped(itemStack, player); break; } } }