Search in sources :

Example 1 with TileInventoryAdapter

use of forestry.core.inventory.TileInventoryAdapter in project ForestryMC by ForestryMC.

the class TileFarmPlain method createInventory.

protected void createInventory() {
    setInternalInventory(new TileInventoryAdapter(this, SLOT_COUNT, "Items") {

        @Override
        public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
            if (GuiUtil.isIndexInRange(slotIndex, SLOT_FERTILIZER, SLOT_FERTILIZER_COUNT)) {
                return acceptsAsFertilizer(itemStack);
            } else if (GuiUtil.isIndexInRange(slotIndex, SLOT_GERMLINGS_1, SLOT_GERMLINGS_COUNT)) {
                return acceptsAsGermling(itemStack);
            } else if (GuiUtil.isIndexInRange(slotIndex, SLOT_RESOURCES_1, SLOT_RESOURCES_COUNT)) {
                return acceptsAsResource(itemStack);
            } else if (GuiUtil.isIndexInRange(slotIndex, SLOT_CAN, SLOT_CAN_COUNT)) {
                Fluid fluid = FluidHelper.getFluidInContainer(itemStack);
                return tankManager.accepts(fluid);
            }
            return false;
        }

        @Override
        public boolean canExtractItem(int slotIndex, ItemStack stack, int side) {
            return GuiUtil.isIndexInRange(slotIndex, SLOT_PRODUCTION_1, SLOT_PRODUCTION_COUNT);
        }
    });
    FilteredTank liquidTank = new FilteredTank(Defaults.PROCESSOR_TANK_CAPACITY, FluidRegistry.WATER);
    tankManager = new TankManager(liquidTank);
}
Also used : TileInventoryAdapter(forestry.core.inventory.TileInventoryAdapter) TankManager(forestry.core.fluids.TankManager) Fluid(net.minecraftforge.fluids.Fluid) ItemStack(net.minecraft.item.ItemStack) FilteredTank(forestry.core.fluids.tanks.FilteredTank)

Aggregations

TankManager (forestry.core.fluids.TankManager)1 FilteredTank (forestry.core.fluids.tanks.FilteredTank)1 TileInventoryAdapter (forestry.core.inventory.TileInventoryAdapter)1 ItemStack (net.minecraft.item.ItemStack)1 Fluid (net.minecraftforge.fluids.Fluid)1