Search in sources :

Example 1 with BarrelBlockEntity

use of net.minecraft.world.level.block.entity.BarrelBlockEntity in project Create by Creators-of-Create.

the class MountedStorage method canUseAsStorage.

public static boolean canUseAsStorage(BlockEntity te) {
    if (te == null)
        return false;
    if (te instanceof MechanicalCrafterTileEntity)
        return false;
    if (AllTileEntities.CREATIVE_CRATE.is(te))
        return true;
    if (te instanceof ShulkerBoxBlockEntity)
        return true;
    if (te instanceof ChestBlockEntity)
        return true;
    if (te instanceof BarrelBlockEntity)
        return true;
    if (te instanceof ItemVaultTileEntity)
        return true;
    LazyOptional<IItemHandler> capability = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY);
    IItemHandler handler = capability.orElse(null);
    return handler instanceof ItemStackHandler && !(handler instanceof ProcessingInventory);
}
Also used : ItemStackHandler(net.minecraftforge.items.ItemStackHandler) ShulkerBoxBlockEntity(net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity) ChestBlockEntity(net.minecraft.world.level.block.entity.ChestBlockEntity) IItemHandler(net.minecraftforge.items.IItemHandler) ItemVaultTileEntity(com.simibubi.create.content.logistics.block.vault.ItemVaultTileEntity) BarrelBlockEntity(net.minecraft.world.level.block.entity.BarrelBlockEntity) MechanicalCrafterTileEntity(com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterTileEntity) ProcessingInventory(com.simibubi.create.content.contraptions.processing.ProcessingInventory)

Aggregations

MechanicalCrafterTileEntity (com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterTileEntity)1 ProcessingInventory (com.simibubi.create.content.contraptions.processing.ProcessingInventory)1 ItemVaultTileEntity (com.simibubi.create.content.logistics.block.vault.ItemVaultTileEntity)1 BarrelBlockEntity (net.minecraft.world.level.block.entity.BarrelBlockEntity)1 ChestBlockEntity (net.minecraft.world.level.block.entity.ChestBlockEntity)1 ShulkerBoxBlockEntity (net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity)1 IItemHandler (net.minecraftforge.items.IItemHandler)1 ItemStackHandler (net.minecraftforge.items.ItemStackHandler)1