Search in sources :

Example 1 with StorageBlock

use of com.almuradev.almura.feature.storage.block.StorageBlock in project Almura by AlmuraDev.

the class MultiSlotTileEntity method onLoad.

@Override
public void onLoad() {
    final IMultiSlotItemHandler itemHandler = (IMultiSlotItemHandler) this.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
    final IBlockState state = this.world.getBlockState(this.pos);
    final Block block = state.getBlock();
    if (block instanceof StorageBlock) {
        final int slotCount = ((StorageBlock) block).getSlotCount();
        itemHandler.resize(slotCount);
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) StorageBlock(com.almuradev.almura.feature.storage.block.StorageBlock) Block(net.minecraft.block.Block) IMultiSlotItemHandler(com.almuradev.almura.shared.capability.IMultiSlotItemHandler) StorageBlock(com.almuradev.almura.feature.storage.block.StorageBlock)

Aggregations

StorageBlock (com.almuradev.almura.feature.storage.block.StorageBlock)1 IMultiSlotItemHandler (com.almuradev.almura.shared.capability.IMultiSlotItemHandler)1 Block (net.minecraft.block.Block)1 IBlockState (net.minecraft.block.state.IBlockState)1