Search in sources :

Example 6 with CompoundTagImpl

use of com.denizenscript.denizen.nms.v1_17.impl.jnbt.CompoundTagImpl in project Denizen-For-Bukkit by DenizenScript.

the class PacketHelperImpl method showTileEntityData.

@Override
public void showTileEntityData(Player player, Location location, int action, CompoundTag compoundTag) {
    BlockPos position = new BlockPos(location.getX(), location.getY(), location.getZ());
    try {
        ClientboundBlockEntityDataPacket packet = (ClientboundBlockEntityDataPacket) BLOCK_ENTITY_DATA_PACKET_CONSTRUCTOR.invoke(position, action, ((CompoundTagImpl) compoundTag).toNMSTag());
        send(player, packet);
    } catch (Throwable ex) {
        Debug.echoError(ex);
    }
}
Also used : BlockPos(net.minecraft.core.BlockPos) CompoundTagImpl(com.denizenscript.denizen.nms.v1_18.impl.jnbt.CompoundTagImpl)

Example 7 with CompoundTagImpl

use of com.denizenscript.denizen.nms.v1_17.impl.jnbt.CompoundTagImpl 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)

Example 8 with CompoundTagImpl

use of com.denizenscript.denizen.nms.v1_17.impl.jnbt.CompoundTagImpl in project Denizen-For-Bukkit by DenizenScript.

the class ImprovedOfflinePlayerImpl method setInventory.

@Override
public void setInventory(org.bukkit.inventory.PlayerInventory inventory) {
    CraftInventoryPlayer inv = (CraftInventoryPlayer) inventory;
    net.minecraft.nbt.CompoundTag nbtTagCompound = ((CompoundTagImpl) compound).toNMSTag();
    nbtTagCompound.put("Inventory", inv.getInventory().save(new ListTag()));
    this.compound = CompoundTagImpl.fromNMSTag(nbtTagCompound);
    if (this.autosave) {
        savePlayerData();
    }
}
Also used : CraftInventoryPlayer(org.bukkit.craftbukkit.v1_18_R1.inventory.CraftInventoryPlayer) ListTag(net.minecraft.nbt.ListTag) CompoundTagImpl(com.denizenscript.denizen.nms.v1_18.impl.jnbt.CompoundTagImpl)

Example 9 with CompoundTagImpl

use of com.denizenscript.denizen.nms.v1_17.impl.jnbt.CompoundTagImpl in project Denizen-For-Bukkit by DenizenScript.

the class ImprovedOfflinePlayerImpl method getAttributes.

private AttributeMap getAttributes() {
    AttributeMap amb = new AttributeMap(DefaultAttributes.getSupplier(net.minecraft.world.entity.EntityType.PLAYER));
    amb.load(((CompoundTagImpl) this.compound).toNMSTag().getList("Attributes", 10));
    return amb;
}
Also used : AttributeMap(net.minecraft.world.entity.ai.attributes.AttributeMap) CompoundTagImpl(com.denizenscript.denizen.nms.v1_18.impl.jnbt.CompoundTagImpl)

Example 10 with CompoundTagImpl

use of com.denizenscript.denizen.nms.v1_17.impl.jnbt.CompoundTagImpl in project Denizen-For-Bukkit by DenizenScript.

the class ImprovedOfflinePlayerImpl method setInventory.

@Override
public void setInventory(org.bukkit.inventory.PlayerInventory inventory) {
    CraftInventoryPlayer inv = (CraftInventoryPlayer) inventory;
    net.minecraft.nbt.CompoundTag nbtTagCompound = ((CompoundTagImpl) compound).toNMSTag();
    nbtTagCompound.put("Inventory", inv.getInventory().save(new ListTag()));
    this.compound = CompoundTagImpl.fromNMSTag(nbtTagCompound);
    if (this.autosave) {
        savePlayerData();
    }
}
Also used : CraftInventoryPlayer(org.bukkit.craftbukkit.v1_17_R1.inventory.CraftInventoryPlayer) ListTag(net.minecraft.nbt.ListTag) CompoundTagImpl(com.denizenscript.denizen.nms.v1_17.impl.jnbt.CompoundTagImpl)

Aggregations

CompoundTagImpl (com.denizenscript.denizen.nms.v1_17.impl.jnbt.CompoundTagImpl)4 CompoundTagImpl (com.denizenscript.denizen.nms.v1_18.impl.jnbt.CompoundTagImpl)4 Inventory (org.bukkit.inventory.Inventory)3 CompoundTagImpl (com.denizenscript.denizen.nms.v1_16.impl.jnbt.CompoundTagImpl)2 BlockPos (net.minecraft.core.BlockPos)2 ListTag (net.minecraft.nbt.ListTag)2 AttributeMap (net.minecraft.world.entity.ai.attributes.AttributeMap)2 PlayerEnderChestContainer (net.minecraft.world.inventory.PlayerEnderChestContainer)2 CraftInventory (org.bukkit.craftbukkit.v1_16_R3.inventory.CraftInventory)1 CraftInventoryPlayer (org.bukkit.craftbukkit.v1_16_R3.inventory.CraftInventoryPlayer)1 CraftInventory (org.bukkit.craftbukkit.v1_17_R1.inventory.CraftInventory)1 CraftInventoryPlayer (org.bukkit.craftbukkit.v1_17_R1.inventory.CraftInventoryPlayer)1 CraftInventory (org.bukkit.craftbukkit.v1_18_R1.inventory.CraftInventory)1 CraftInventoryPlayer (org.bukkit.craftbukkit.v1_18_R1.inventory.CraftInventoryPlayer)1