Posted May 10, 20178 yr Hello everyone, I'm working on a multiblock structure with a core tile entity that should store all the data, like items. I got another tile entity in the multiblock that should be able to in- and output items to and from the inventory of that core tile entity. I tried to achieve this by returning the instance of the ItemStackHandler of the core tile entity in the getCapability method in the other tile entity. It looks like this: //The class that should in and output to the core tile entity public class TileEntityMultiblockItemHandler extends TileEntity implements IMultiblockTileEntity{ private TSMultiblock block; public TileEntityMultiblockItemHandler() { } @Override public TSMultiblock getMultiblock() { return ((IMultiblockBlock)world.getBlockState(pos).getBlock()).getMultiblock(world, pos); } @Override public boolean hasCapability(Capability<?> capability, EnumFacing facing) { if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return true; } return super.hasCapability(capability, facing); } @Override public <T> T getCapability(Capability<T> capability, EnumFacing facing) { if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return (T) getMultiblock().getCoreEntity().getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing); } return super.getCapability(capability, facing); } @Override public void onMultiblockLoad() { } } And //The core tile entity public class TileEntityFabricator extends TileEntityMachineBasic implements ITickable, IInteractionObject, ITileEntityInterface{ private int currentFormTime; private int totalFormTime; private int energyConsumption; private TSEnergyStorage energy; private TSItemStorage inventory; public TileEntityFabricator() { totalFormTime = TSConfigHandler.runtimeFabricator; currentFormTime = 0; energyConsumption = TSConfigHandler.fabricatorConsumption; energy = new TSEnergyStorage(10000, 0, 0); inventory = new TSItemStorage(10); } //I left a bunch of methods out here @Override public boolean hasCapability(Capability<?> capability, EnumFacing facing) { if (capability == CapabilityEnergy.ENERGY) { return true; } if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return true; } return super.hasCapability(capability, facing); } @Override public <T> T getCapability(Capability<T> capability, EnumFacing facing) { if (capability == CapabilityEnergy.ENERGY) { return (T) energy; } if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return (T) inventory; } return super.getCapability(capability, facing); } } The problem: when I attach a hopper to the itemhandler tile entity, it inputs items, but I can't see them on the gui. Furthermore, I can get the items I put in out again with a hopper, but the items inside that I can see and access through the gui stay put. What have I done wrong? Edited May 10, 20178 yr by tommyte quick spelling corrections (:
May 10, 20178 yr Author False alarm, I figured it out already. My 'getCoreEntity()' method didn't work properly. I wonder why it didn't spit out an error, but o well. Thanks anyways!
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.