Search in sources :

Example 1 with PlayerEnderChestContainer

use of net.minecraft.world.inventory.PlayerEnderChestContainer in project Denizen-For-Bukkit by DenizenScript.

the class ImprovedOfflinePlayerImpl method getEnderChest.

@Override
public Inventory getEnderChest() {
    if (offlineEnderChests.containsKey(getUniqueId())) {
        return offlineEnderChests.get(getUniqueId());
    }
    PlayerEnderChestContainer endchest = new PlayerEnderChestContainer(null);
    endchest.fromTag(((CompoundTagImpl) this.compound).toNMSTag().getList("EnderItems", 10));
    org.bukkit.inventory.Inventory inv = new CraftInventory(endchest);
    offlineEnderChests.put(getUniqueId(), inv);
    return inv;
}
Also used : PlayerEnderChestContainer(net.minecraft.world.inventory.PlayerEnderChestContainer) CraftInventory(org.bukkit.craftbukkit.v1_17_R1.inventory.CraftInventory) Inventory(org.bukkit.inventory.Inventory) CompoundTagImpl(com.denizenscript.denizen.nms.v1_17.impl.jnbt.CompoundTagImpl)

Example 2 with PlayerEnderChestContainer

use of net.minecraft.world.inventory.PlayerEnderChestContainer in project Denizen-For-Bukkit by DenizenScript.

the class ImprovedOfflinePlayerImpl method getEnderChest.

@Override
public Inventory getEnderChest() {
    if (offlineEnderChests.containsKey(getUniqueId())) {
        return offlineEnderChests.get(getUniqueId());
    }
    PlayerEnderChestContainer endchest = new PlayerEnderChestContainer(null);
    endchest.fromTag(((CompoundTagImpl) this.compound).toNMSTag().getList("EnderItems", 10));
    org.bukkit.inventory.Inventory inv = new CraftInventory(endchest);
    offlineEnderChests.put(getUniqueId(), inv);
    return inv;
}
Also used : PlayerEnderChestContainer(net.minecraft.world.inventory.PlayerEnderChestContainer) CraftInventory(org.bukkit.craftbukkit.v1_18_R1.inventory.CraftInventory) Inventory(org.bukkit.inventory.Inventory) CompoundTagImpl(com.denizenscript.denizen.nms.v1_18.impl.jnbt.CompoundTagImpl)

Aggregations

PlayerEnderChestContainer (net.minecraft.world.inventory.PlayerEnderChestContainer)2 Inventory (org.bukkit.inventory.Inventory)2 CompoundTagImpl (com.denizenscript.denizen.nms.v1_17.impl.jnbt.CompoundTagImpl)1 CompoundTagImpl (com.denizenscript.denizen.nms.v1_18.impl.jnbt.CompoundTagImpl)1 CraftInventory (org.bukkit.craftbukkit.v1_17_R1.inventory.CraftInventory)1 CraftInventory (org.bukkit.craftbukkit.v1_18_R1.inventory.CraftInventory)1