use of org.bukkit.craftbukkit.v1_18_R2.inventory.CraftInventory in project Magma-1.16.x by magmafoundation.
the class CraftLootTable method fillInventory.
@Override
public void fillInventory(Inventory inventory, Random random, LootContext context) {
net.minecraft.loot.LootContext nmsContext = convertContext(context);
CraftInventory craftInventory = (CraftInventory) inventory;
IInventory handle = craftInventory.getInventory();
// TODO: When events are added, call event here w/ custom reason?
getHandle().fill(handle, nmsContext);
}
use of org.bukkit.craftbukkit.v1_18_R2.inventory.CraftInventory in project Magma-1.16.x by magmafoundation.
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;
}
use of org.bukkit.craftbukkit.v1_18_R2.inventory.CraftInventory 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;
}
Aggregations