Search in sources :

Example 1 with ChestBlock

use of net.minecraft.block.ChestBlock in project BluePower by Qmunity.

the class IOHelper method getInventoryForTE.

public static IInventory getInventoryForTE(TileEntity te) {
    if (te instanceof IInventory) {
        IInventory inv = (IInventory) te;
        BlockState block = te.getBlockState();
        if (block.getBlock() instanceof ChestBlock) {
            inv = (IInventory) ((ChestBlock) block.getBlock()).getMenuProvider(block, te.getLevel(), te.getBlockPos());
        }
        return inv;
    } else {
        return null;
    }
}
Also used : IInventory(net.minecraft.inventory.IInventory) BlockState(net.minecraft.block.BlockState) ChestBlock(net.minecraft.block.ChestBlock)

Aggregations

BlockState (net.minecraft.block.BlockState)1 ChestBlock (net.minecraft.block.ChestBlock)1 IInventory (net.minecraft.inventory.IInventory)1