Search in sources :

Example 1 with ItemHandlerBeltSegment

use of com.simibubi.create.content.contraptions.relays.belt.transport.ItemHandlerBeltSegment in project Create by Creators-of-Create.

the class BeltTileEntity method initializeItemHandler.

protected void initializeItemHandler() {
    if (level.isClientSide || itemHandler.isPresent())
        return;
    if (!level.isLoaded(controller))
        return;
    BlockEntity te = level.getBlockEntity(controller);
    if (te == null || !(te instanceof BeltTileEntity))
        return;
    BeltInventory inventory = ((BeltTileEntity) te).getInventory();
    if (inventory == null)
        return;
    IItemHandler handler = new ItemHandlerBeltSegment(inventory, index);
    itemHandler = LazyOptional.of(() -> handler);
}
Also used : ItemHandlerBeltSegment(com.simibubi.create.content.contraptions.relays.belt.transport.ItemHandlerBeltSegment) BeltInventory(com.simibubi.create.content.contraptions.relays.belt.transport.BeltInventory) IItemHandler(net.minecraftforge.items.IItemHandler) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity)

Aggregations

BeltInventory (com.simibubi.create.content.contraptions.relays.belt.transport.BeltInventory)1 ItemHandlerBeltSegment (com.simibubi.create.content.contraptions.relays.belt.transport.ItemHandlerBeltSegment)1 BlockEntity (net.minecraft.world.level.block.entity.BlockEntity)1 IItemHandler (net.minecraftforge.items.IItemHandler)1