Search in sources :

Example 6 with CraftInventoryDoubleChest

use of org.bukkit.craftbukkit.v1_16_R3.inventory.CraftInventoryDoubleChest in project LoliServer by Loli-Server.

the class CraftChest method getInventory.

@Override
public Inventory getInventory() {
    CraftInventory inventory = (CraftInventory) this.getBlockInventory();
    if (!isPlaced()) {
        return inventory;
    }
    // The logic here is basically identical to the logic in ChestBlock.interact
    CraftWorld world = (CraftWorld) this.getWorld();
    ChestBlock blockChest = (ChestBlock) (this.getType() == Material.CHEST ? Blocks.CHEST : Blocks.TRAPPED_CHEST);
    INamedContainerProvider nms = blockChest.getMenuProvider(data, world.getHandle(), this.getPosition());
    if (nms instanceof ChestBlock.DoubleInventory) {
        inventory = new CraftInventoryDoubleChest((ChestBlock.DoubleInventory) nms);
    }
    return inventory;
}
Also used : CraftInventory(org.bukkit.craftbukkit.v1_16_R3.inventory.CraftInventory) INamedContainerProvider(net.minecraft.inventory.container.INamedContainerProvider) ChestBlock(net.minecraft.block.ChestBlock) CraftInventoryDoubleChest(org.bukkit.craftbukkit.v1_16_R3.inventory.CraftInventoryDoubleChest) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld)

Aggregations

INamedContainerProvider (net.minecraft.inventory.container.INamedContainerProvider)3 CraftInventory (org.bukkit.craftbukkit.v1_16_R3.inventory.CraftInventory)3 CraftInventoryDoubleChest (org.bukkit.craftbukkit.v1_16_R3.inventory.CraftInventoryDoubleChest)3 ChestBlock (net.minecraft.block.ChestBlock)2 MenuProvider (net.minecraft.world.MenuProvider)2 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)2 CraftInventory (org.bukkit.craftbukkit.v1_18_R2.inventory.CraftInventory)2 CraftInventoryDoubleChest (org.bukkit.craftbukkit.v1_18_R2.inventory.CraftInventoryDoubleChest)2 ServerPlayerEntity (net.minecraft.entity.player.ServerPlayerEntity)1 Container (net.minecraft.inventory.container.Container)1 ServerPlayer (net.minecraft.server.level.ServerPlayer)1 LockableTileEntity (net.minecraft.tileentity.LockableTileEntity)1 TileEntity (net.minecraft.tileentity.TileEntity)1 BlockPos (net.minecraft.util.math.BlockPos)1 AbstractContainerMenu (net.minecraft.world.inventory.AbstractContainerMenu)1 ChestBlock (net.minecraft.world.level.block.ChestBlock)1 BlockEntity (net.minecraft.world.level.block.entity.BlockEntity)1 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)1 CraftInventory (org.bukkit.craftbukkit.v1_12_R1.inventory.CraftInventory)1 CraftInventoryDoubleChest (org.bukkit.craftbukkit.v1_12_R1.inventory.CraftInventoryDoubleChest)1