use of com.almuradev.almura.shared.capability.IMultiSlotItemHandler in project Almura by AlmuraDev.
the class StorageBlock method createNewTileEntity.
@Nullable
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
final MultiSlotTileEntity mte = new MultiSlotTileEntity();
final IMultiSlotItemHandler itemHandler = (MultiSlotItemHandler) mte.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
if (this.slotAmount > itemHandler.getSlots()) {
itemHandler.resize(this.slotAmount);
}
return mte;
}
use of com.almuradev.almura.shared.capability.IMultiSlotItemHandler 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);
}
}
Aggregations