use of forestry.storage.gui.ContainerNaturalistBackpack in project ForestryMC by ForestryMC.
the class ItemBackpackNaturalist method getGui.
@Override
@SideOnly(Side.CLIENT)
public GuiContainer getGui(EntityPlayer player, ItemStack heldItem, int page) {
ItemInventoryBackpackPaged inventory = new ItemInventoryBackpackPaged(player, Constants.SLOTS_BACKPACK_APIARIST, heldItem, this);
ContainerNaturalistBackpack container = new ContainerNaturalistBackpack(player, inventory, page);
return new GuiNaturalistInventory(speciesRoot, player, container, page, 5);
}
use of forestry.storage.gui.ContainerNaturalistBackpack in project ForestryMC by ForestryMC.
the class PickupHandlerStorage method onItemPickup.
@Override
public boolean onItemPickup(EntityPlayer player, EntityItem entityitem) {
ItemStack itemstack = entityitem.getItem();
if (itemstack.isEmpty()) {
return false;
}
// Do not pick up if a backpack is open
if (player.openContainer instanceof ContainerBackpack || player.openContainer instanceof ContainerNaturalistBackpack) {
return false;
}
// Make sure to top off manually placed itemstacks in player inventory first
topOffPlayerInventory(player, itemstack);
for (ItemStack pack : player.inventory.mainInventory) {
if (itemstack.isEmpty()) {
break;
}
if (pack.isEmpty() || !(pack.getItem() instanceof ItemBackpack)) {
continue;
}
ItemBackpack backpack = (ItemBackpack) pack.getItem();
IBackpackDefinition backpackDefinition = backpack.getDefinition();
if (backpackDefinition.getFilter().test(itemstack)) {
ItemBackpack.tryStowing(player, pack, itemstack);
}
}
return itemstack.isEmpty();
}
Aggregations