From 75c11b19a7b5dd241942f8d7dde92b5ec1f8eaea Mon Sep 17 00:00:00 2001 From: Brianna Date: Mon, 12 Apr 2021 11:06:45 -0500 Subject: [PATCH] Added byte arrays to the nbt api. --- .../com/songoda/core/nms/nbt/NBTCompound.java | 4 +++ .../com/songoda/core/nms/nbt/NBTObject.java | 2 ++ .../nms/v1_10_R1/nbt/NBTCompoundImpl.java | 11 ++++++++ .../core/nms/v1_10_R1/nbt/NBTItemImpl.java | 2 +- .../core/nms/v1_10_R1/nbt/NBTObjectImpl.java | 5 ++++ .../nms/v1_11_R1/nbt/NBTCompoundImpl.java | 11 ++++++++ .../core/nms/v1_11_R1/nbt/NBTItemImpl.java | 14 ++++++++++- .../core/nms/v1_11_R1/nbt/NBTObjectImpl.java | 5 ++++ .../nms/v1_12_R1/nbt/NBTCompoundImpl.java | 11 ++++++++ .../core/nms/v1_12_R1/nbt/NBTItemImpl.java | 2 +- .../core/nms/v1_12_R1/nbt/NBTObjectImpl.java | 5 ++++ .../nms/v1_13_R1/nbt/NBTCompoundImpl.java | 11 ++++++++ .../core/nms/v1_13_R1/nbt/NBTItemImpl.java | 2 +- .../core/nms/v1_13_R1/nbt/NBTObjectImpl.java | 5 ++++ .../nms/v1_13_R2/nbt/NBTCompoundImpl.java | 11 ++++++++ .../core/nms/v1_13_R2/nbt/NBTItemImpl.java | 14 ++++++++++- .../core/nms/v1_13_R2/nbt/NBTObjectImpl.java | 5 ++++ .../nms/v1_14_R1/nbt/NBTCompoundImpl.java | 11 ++++++++ .../core/nms/v1_14_R1/nbt/NBTItemImpl.java | 14 ++++++++++- .../core/nms/v1_14_R1/nbt/NBTObjectImpl.java | 5 ++++ .../nms/v1_15_R1/nbt/NBTCompoundImpl.java | 11 ++++++++ .../core/nms/v1_15_R1/nbt/NBTEntityImpl.java | 12 +++++++++ .../core/nms/v1_15_R1/nbt/NBTItemImpl.java | 2 +- .../core/nms/v1_15_R1/nbt/NBTObjectImpl.java | 5 ++++ .../nms/v1_16_R1/nbt/NBTCompoundImpl.java | 11 ++++++++ .../core/nms/v1_16_R1/nbt/NBTItemImpl.java | 14 ++++++++++- .../core/nms/v1_16_R1/nbt/NBTObjectImpl.java | 5 ++++ .../nms/v1_16_R2/nbt/NBTCompoundImpl.java | 11 ++++++++ .../core/nms/v1_16_R2/nbt/NBTItemImpl.java | 2 +- .../core/nms/v1_16_R2/nbt/NBTObjectImpl.java | 5 ++++ .../nms/v1_16_R3/nbt/NBTCompoundImpl.java | 11 ++++++++ .../core/nms/v1_16_R3/nbt/NBTItemImpl.java | 25 +------------------ .../core/nms/v1_16_R3/nbt/NBTObjectImpl.java | 5 ++++ .../core/nms/v1_8_R1/nbt/NBTCompoundImpl.java | 11 ++++++++ .../core/nms/v1_8_R1/nbt/NBTItemImpl.java | 2 +- .../core/nms/v1_8_R1/nbt/NBTObjectImpl.java | 5 ++++ .../core/nms/v1_8_R2/nbt/NBTCompoundImpl.java | 11 ++++++++ .../core/nms/v1_8_R2/nbt/NBTItemImpl.java | 2 +- .../core/nms/v1_8_R2/nbt/NBTObjectImpl.java | 5 ++++ .../core/nms/v1_8_R3/nbt/NBTCompoundImpl.java | 11 ++++++++ .../core/nms/v1_8_R3/nbt/NBTEntityImpl.java | 12 +++++++++ .../core/nms/v1_8_R3/nbt/NBTItemImpl.java | 2 +- .../core/nms/v1_8_R3/nbt/NBTObjectImpl.java | 5 ++++ .../core/nms/v1_9_R1/nbt/NBTCompoundImpl.java | 11 ++++++++ .../core/nms/v1_9_R1/nbt/NBTItemImpl.java | 2 +- .../core/nms/v1_9_R1/nbt/NBTObjectImpl.java | 5 ++++ .../core/nms/v1_9_R2/nbt/NBTCompoundImpl.java | 11 ++++++++ .../core/nms/v1_9_R2/nbt/NBTItemImpl.java | 2 +- .../core/nms/v1_9_R2/nbt/NBTObjectImpl.java | 5 ++++ 49 files changed, 333 insertions(+), 38 deletions(-) diff --git a/NMS/NMS-API/src/com/songoda/core/nms/nbt/NBTCompound.java b/NMS/NMS-API/src/com/songoda/core/nms/nbt/NBTCompound.java index 7bd47801..269dfc2c 100644 --- a/NMS/NMS-API/src/com/songoda/core/nms/nbt/NBTCompound.java +++ b/NMS/NMS-API/src/com/songoda/core/nms/nbt/NBTCompound.java @@ -21,6 +21,8 @@ public interface NBTCompound { NBTCompound set(String tag, int[] i); + NBTCompound set(String tag, byte[] b); + NBTCompound set(String tag, UUID u); NBTCompound remove(String tag); @@ -45,6 +47,8 @@ public interface NBTCompound { int[] getIntArray(String tag); + byte[] getByteArray(String tag); + NBTCompound getCompound(String tag); Set getKeys(); diff --git a/NMS/NMS-API/src/com/songoda/core/nms/nbt/NBTObject.java b/NMS/NMS-API/src/com/songoda/core/nms/nbt/NBTObject.java index 8fa3fbae..c43b12c1 100644 --- a/NMS/NMS-API/src/com/songoda/core/nms/nbt/NBTObject.java +++ b/NMS/NMS-API/src/com/songoda/core/nms/nbt/NBTObject.java @@ -20,6 +20,8 @@ public interface NBTObject { int[] asIntArray(); + byte[] asByteArray(); + Set getKeys(); NBTCompound asCompound(); diff --git a/NMS/NMS-v1_10_R1/src/com/songoda/core/nms/v1_10_R1/nbt/NBTCompoundImpl.java b/NMS/NMS-v1_10_R1/src/com/songoda/core/nms/v1_10_R1/nbt/NBTCompoundImpl.java index 480887c5..04c306f5 100644 --- a/NMS/NMS-v1_10_R1/src/com/songoda/core/nms/v1_10_R1/nbt/NBTCompoundImpl.java +++ b/NMS/NMS-v1_10_R1/src/com/songoda/core/nms/v1_10_R1/nbt/NBTCompoundImpl.java @@ -74,6 +74,12 @@ public class NBTCompoundImpl implements NBTCompound { return this; } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + @Override public NBTCompound set(String tag, UUID u) { compound.a(tag, u); @@ -136,6 +142,11 @@ public class NBTCompoundImpl implements NBTCompound { return getNBTObject(tag).asIntArray(); } + @Override + public byte[] getByteArray(String tag) { + return new byte[0]; + } + @Override public NBTCompound getCompound(String tag) { if (has(tag)) { diff --git a/NMS/NMS-v1_10_R1/src/com/songoda/core/nms/v1_10_R1/nbt/NBTItemImpl.java b/NMS/NMS-v1_10_R1/src/com/songoda/core/nms/v1_10_R1/nbt/NBTItemImpl.java index ed8858d0..c4fb4426 100644 --- a/NMS/NMS-v1_10_R1/src/com/songoda/core/nms/v1_10_R1/nbt/NBTItemImpl.java +++ b/NMS/NMS-v1_10_R1/src/com/songoda/core/nms/v1_10_R1/nbt/NBTItemImpl.java @@ -7,7 +7,7 @@ import org.bukkit.inventory.ItemStack; public class NBTItemImpl extends NBTCompoundImpl implements NBTItem { - private net.minecraft.server.v1_10_R1.ItemStack nmsItem; + private final net.minecraft.server.v1_10_R1.ItemStack nmsItem; public NBTItemImpl(net.minecraft.server.v1_10_R1.ItemStack nmsItem) { super(nmsItem != null && nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound()); diff --git a/NMS/NMS-v1_10_R1/src/com/songoda/core/nms/v1_10_R1/nbt/NBTObjectImpl.java b/NMS/NMS-v1_10_R1/src/com/songoda/core/nms/v1_10_R1/nbt/NBTObjectImpl.java index 8bad61b3..6df4ab6f 100644 --- a/NMS/NMS-v1_10_R1/src/com/songoda/core/nms/v1_10_R1/nbt/NBTObjectImpl.java +++ b/NMS/NMS-v1_10_R1/src/com/songoda/core/nms/v1_10_R1/nbt/NBTObjectImpl.java @@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject { return compound.getIntArray(tag); } + @Override + public byte[] asByteArray() { + return compound.getByteArray(tag); + } + @Override public Set getKeys() { return compound.c(); diff --git a/NMS/NMS-v1_11_R1/src/com/songoda/core/nms/v1_11_R1/nbt/NBTCompoundImpl.java b/NMS/NMS-v1_11_R1/src/com/songoda/core/nms/v1_11_R1/nbt/NBTCompoundImpl.java index 8eba6c34..9680ccf0 100644 --- a/NMS/NMS-v1_11_R1/src/com/songoda/core/nms/v1_11_R1/nbt/NBTCompoundImpl.java +++ b/NMS/NMS-v1_11_R1/src/com/songoda/core/nms/v1_11_R1/nbt/NBTCompoundImpl.java @@ -74,6 +74,12 @@ public class NBTCompoundImpl implements NBTCompound { return this; } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + @Override public NBTCompound set(String tag, UUID u) { compound.a(tag, u); @@ -136,6 +142,11 @@ public class NBTCompoundImpl implements NBTCompound { return getNBTObject(tag).asIntArray(); } + @Override + public byte[] getByteArray(String tag) { + return new byte[0]; + } + @Override public NBTCompound getCompound(String tag) { if (has(tag)) { diff --git a/NMS/NMS-v1_11_R1/src/com/songoda/core/nms/v1_11_R1/nbt/NBTItemImpl.java b/NMS/NMS-v1_11_R1/src/com/songoda/core/nms/v1_11_R1/nbt/NBTItemImpl.java index 4c3c6b54..0712745b 100644 --- a/NMS/NMS-v1_11_R1/src/com/songoda/core/nms/v1_11_R1/nbt/NBTItemImpl.java +++ b/NMS/NMS-v1_11_R1/src/com/songoda/core/nms/v1_11_R1/nbt/NBTItemImpl.java @@ -1,5 +1,6 @@ package com.songoda.core.nms.v1_11_R1.nbt; +import com.songoda.core.nms.nbt.NBTCompound; import com.songoda.core.nms.nbt.NBTItem; import net.minecraft.server.v1_11_R1.NBTTagCompound; import org.bukkit.craftbukkit.v1_11_R1.inventory.CraftItemStack; @@ -7,7 +8,7 @@ import org.bukkit.inventory.ItemStack; public class NBTItemImpl extends NBTCompoundImpl implements NBTItem { - private net.minecraft.server.v1_11_R1.ItemStack nmsItem; + private final net.minecraft.server.v1_11_R1.ItemStack nmsItem; public NBTItemImpl(net.minecraft.server.v1_11_R1.ItemStack nmsItem) { super(nmsItem != null && nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound()); @@ -22,6 +23,17 @@ public class NBTItemImpl extends NBTCompoundImpl implements NBTItem { } } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + + @Override + public byte[] getByteArray(String tag) { + return new byte[0]; + } + @Override public void addExtras() { } diff --git a/NMS/NMS-v1_11_R1/src/com/songoda/core/nms/v1_11_R1/nbt/NBTObjectImpl.java b/NMS/NMS-v1_11_R1/src/com/songoda/core/nms/v1_11_R1/nbt/NBTObjectImpl.java index 0b2a71b8..c6075963 100644 --- a/NMS/NMS-v1_11_R1/src/com/songoda/core/nms/v1_11_R1/nbt/NBTObjectImpl.java +++ b/NMS/NMS-v1_11_R1/src/com/songoda/core/nms/v1_11_R1/nbt/NBTObjectImpl.java @@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject { return compound.getIntArray(tag); } + @Override + public byte[] asByteArray() { + return compound.getByteArray(tag); + } + @Override public Set getKeys() { return compound.c(); diff --git a/NMS/NMS-v1_12_R1/src/com/songoda/core/nms/v1_12_R1/nbt/NBTCompoundImpl.java b/NMS/NMS-v1_12_R1/src/com/songoda/core/nms/v1_12_R1/nbt/NBTCompoundImpl.java index 61206c77..6b13d2b3 100644 --- a/NMS/NMS-v1_12_R1/src/com/songoda/core/nms/v1_12_R1/nbt/NBTCompoundImpl.java +++ b/NMS/NMS-v1_12_R1/src/com/songoda/core/nms/v1_12_R1/nbt/NBTCompoundImpl.java @@ -74,6 +74,12 @@ public class NBTCompoundImpl implements NBTCompound { return this; } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + @Override public NBTCompound set(String tag, UUID u) { compound.a(tag, u); @@ -136,6 +142,11 @@ public class NBTCompoundImpl implements NBTCompound { return getNBTObject(tag).asIntArray(); } + @Override + public byte[] getByteArray(String tag) { + return new byte[0]; + } + @Override public NBTCompound getCompound(String tag) { if (has(tag)) { diff --git a/NMS/NMS-v1_12_R1/src/com/songoda/core/nms/v1_12_R1/nbt/NBTItemImpl.java b/NMS/NMS-v1_12_R1/src/com/songoda/core/nms/v1_12_R1/nbt/NBTItemImpl.java index e22df8c9..e867af00 100644 --- a/NMS/NMS-v1_12_R1/src/com/songoda/core/nms/v1_12_R1/nbt/NBTItemImpl.java +++ b/NMS/NMS-v1_12_R1/src/com/songoda/core/nms/v1_12_R1/nbt/NBTItemImpl.java @@ -7,7 +7,7 @@ import org.bukkit.inventory.ItemStack; public class NBTItemImpl extends NBTCompoundImpl implements NBTItem { - private net.minecraft.server.v1_12_R1.ItemStack nmsItem; + private final net.minecraft.server.v1_12_R1.ItemStack nmsItem; public NBTItemImpl(net.minecraft.server.v1_12_R1.ItemStack nmsItem) { super(nmsItem != null && nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound()); diff --git a/NMS/NMS-v1_12_R1/src/com/songoda/core/nms/v1_12_R1/nbt/NBTObjectImpl.java b/NMS/NMS-v1_12_R1/src/com/songoda/core/nms/v1_12_R1/nbt/NBTObjectImpl.java index 16b5ab1a..397f66a0 100644 --- a/NMS/NMS-v1_12_R1/src/com/songoda/core/nms/v1_12_R1/nbt/NBTObjectImpl.java +++ b/NMS/NMS-v1_12_R1/src/com/songoda/core/nms/v1_12_R1/nbt/NBTObjectImpl.java @@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject { return compound.getIntArray(tag); } + @Override + public byte[] asByteArray() { + return compound.getByteArray(tag); + } + @Override public Set getKeys() { return compound.c(); diff --git a/NMS/NMS-v1_13_R1/src/com/songoda/core/nms/v1_13_R1/nbt/NBTCompoundImpl.java b/NMS/NMS-v1_13_R1/src/com/songoda/core/nms/v1_13_R1/nbt/NBTCompoundImpl.java index 8efaeb23..70a850a1 100644 --- a/NMS/NMS-v1_13_R1/src/com/songoda/core/nms/v1_13_R1/nbt/NBTCompoundImpl.java +++ b/NMS/NMS-v1_13_R1/src/com/songoda/core/nms/v1_13_R1/nbt/NBTCompoundImpl.java @@ -74,6 +74,12 @@ public class NBTCompoundImpl implements NBTCompound { return this; } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + @Override public NBTCompound set(String tag, UUID u) { compound.a(tag, u); @@ -136,6 +142,11 @@ public class NBTCompoundImpl implements NBTCompound { return getNBTObject(tag).asIntArray(); } + @Override + public byte[] getByteArray(String tag) { + return new byte[0]; + } + @Override public NBTCompound getCompound(String tag) { if (has(tag)) { diff --git a/NMS/NMS-v1_13_R1/src/com/songoda/core/nms/v1_13_R1/nbt/NBTItemImpl.java b/NMS/NMS-v1_13_R1/src/com/songoda/core/nms/v1_13_R1/nbt/NBTItemImpl.java index d9059c7e..5824da51 100644 --- a/NMS/NMS-v1_13_R1/src/com/songoda/core/nms/v1_13_R1/nbt/NBTItemImpl.java +++ b/NMS/NMS-v1_13_R1/src/com/songoda/core/nms/v1_13_R1/nbt/NBTItemImpl.java @@ -7,7 +7,7 @@ import org.bukkit.inventory.ItemStack; public class NBTItemImpl extends NBTCompoundImpl implements NBTItem { - private net.minecraft.server.v1_13_R1.ItemStack nmsItem; + private final net.minecraft.server.v1_13_R1.ItemStack nmsItem; public NBTItemImpl(net.minecraft.server.v1_13_R1.ItemStack nmsItem) { super(nmsItem != null && nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound()); diff --git a/NMS/NMS-v1_13_R1/src/com/songoda/core/nms/v1_13_R1/nbt/NBTObjectImpl.java b/NMS/NMS-v1_13_R1/src/com/songoda/core/nms/v1_13_R1/nbt/NBTObjectImpl.java index dbd85039..b5bdaa97 100644 --- a/NMS/NMS-v1_13_R1/src/com/songoda/core/nms/v1_13_R1/nbt/NBTObjectImpl.java +++ b/NMS/NMS-v1_13_R1/src/com/songoda/core/nms/v1_13_R1/nbt/NBTObjectImpl.java @@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject { return compound.getIntArray(tag); } + @Override + public byte[] asByteArray() { + return compound.getByteArray(tag); + } + @Override public Set getKeys() { return compound.getKeys(); diff --git a/NMS/NMS-v1_13_R2/src/com/songoda/core/nms/v1_13_R2/nbt/NBTCompoundImpl.java b/NMS/NMS-v1_13_R2/src/com/songoda/core/nms/v1_13_R2/nbt/NBTCompoundImpl.java index 9f78a280..ad539766 100644 --- a/NMS/NMS-v1_13_R2/src/com/songoda/core/nms/v1_13_R2/nbt/NBTCompoundImpl.java +++ b/NMS/NMS-v1_13_R2/src/com/songoda/core/nms/v1_13_R2/nbt/NBTCompoundImpl.java @@ -74,6 +74,12 @@ public class NBTCompoundImpl implements NBTCompound { return this; } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + @Override public NBTCompound set(String tag, UUID u) { compound.a(tag, u); @@ -136,6 +142,11 @@ public class NBTCompoundImpl implements NBTCompound { return getNBTObject(tag).asIntArray(); } + @Override + public byte[] getByteArray(String tag) { + return new byte[0]; + } + @Override public NBTCompound getCompound(String tag) { if (has(tag)) { diff --git a/NMS/NMS-v1_13_R2/src/com/songoda/core/nms/v1_13_R2/nbt/NBTItemImpl.java b/NMS/NMS-v1_13_R2/src/com/songoda/core/nms/v1_13_R2/nbt/NBTItemImpl.java index 0a1ba3d9..2904c6b3 100644 --- a/NMS/NMS-v1_13_R2/src/com/songoda/core/nms/v1_13_R2/nbt/NBTItemImpl.java +++ b/NMS/NMS-v1_13_R2/src/com/songoda/core/nms/v1_13_R2/nbt/NBTItemImpl.java @@ -1,5 +1,6 @@ package com.songoda.core.nms.v1_13_R2.nbt; +import com.songoda.core.nms.nbt.NBTCompound; import com.songoda.core.nms.nbt.NBTItem; import net.minecraft.server.v1_13_R2.NBTTagCompound; import org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack; @@ -7,7 +8,7 @@ import org.bukkit.inventory.ItemStack; public class NBTItemImpl extends NBTCompoundImpl implements NBTItem { - private net.minecraft.server.v1_13_R2.ItemStack nmsItem; + private final net.minecraft.server.v1_13_R2.ItemStack nmsItem; public NBTItemImpl(net.minecraft.server.v1_13_R2.ItemStack nmsItem) { super(nmsItem != null && nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound()); @@ -22,6 +23,17 @@ public class NBTItemImpl extends NBTCompoundImpl implements NBTItem { } } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + + @Override + public byte[] getByteArray(String tag) { + return new byte[0]; + } + @Override public void addExtras() { } diff --git a/NMS/NMS-v1_13_R2/src/com/songoda/core/nms/v1_13_R2/nbt/NBTObjectImpl.java b/NMS/NMS-v1_13_R2/src/com/songoda/core/nms/v1_13_R2/nbt/NBTObjectImpl.java index 46c039de..b67bfac7 100644 --- a/NMS/NMS-v1_13_R2/src/com/songoda/core/nms/v1_13_R2/nbt/NBTObjectImpl.java +++ b/NMS/NMS-v1_13_R2/src/com/songoda/core/nms/v1_13_R2/nbt/NBTObjectImpl.java @@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject { return compound.getIntArray(tag); } + @Override + public byte[] asByteArray() { + return compound.getByteArray(tag); + } + @Override public Set getKeys() { return compound.getKeys(); diff --git a/NMS/NMS-v1_14_R1/src/com/songoda/core/nms/v1_14_R1/nbt/NBTCompoundImpl.java b/NMS/NMS-v1_14_R1/src/com/songoda/core/nms/v1_14_R1/nbt/NBTCompoundImpl.java index 6d8a8c9d..a62ad6a3 100644 --- a/NMS/NMS-v1_14_R1/src/com/songoda/core/nms/v1_14_R1/nbt/NBTCompoundImpl.java +++ b/NMS/NMS-v1_14_R1/src/com/songoda/core/nms/v1_14_R1/nbt/NBTCompoundImpl.java @@ -74,6 +74,12 @@ public class NBTCompoundImpl implements NBTCompound { return this; } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + @Override public NBTCompound set(String tag, UUID u) { compound.a(tag, u); @@ -136,6 +142,11 @@ public class NBTCompoundImpl implements NBTCompound { return getNBTObject(tag).asIntArray(); } + @Override + public byte[] getByteArray(String tag) { + return new byte[0]; + } + @Override public NBTCompound getCompound(String tag) { if (has(tag)) { diff --git a/NMS/NMS-v1_14_R1/src/com/songoda/core/nms/v1_14_R1/nbt/NBTItemImpl.java b/NMS/NMS-v1_14_R1/src/com/songoda/core/nms/v1_14_R1/nbt/NBTItemImpl.java index 1e55ebea..8d9827bc 100644 --- a/NMS/NMS-v1_14_R1/src/com/songoda/core/nms/v1_14_R1/nbt/NBTItemImpl.java +++ b/NMS/NMS-v1_14_R1/src/com/songoda/core/nms/v1_14_R1/nbt/NBTItemImpl.java @@ -1,5 +1,6 @@ package com.songoda.core.nms.v1_14_R1.nbt; +import com.songoda.core.nms.nbt.NBTCompound; import com.songoda.core.nms.nbt.NBTItem; import net.minecraft.server.v1_14_R1.NBTTagCompound; import org.bukkit.craftbukkit.v1_14_R1.inventory.CraftItemStack; @@ -7,7 +8,7 @@ import org.bukkit.inventory.ItemStack; public class NBTItemImpl extends NBTCompoundImpl implements NBTItem { - private net.minecraft.server.v1_14_R1.ItemStack nmsItem; + private final net.minecraft.server.v1_14_R1.ItemStack nmsItem; public NBTItemImpl(net.minecraft.server.v1_14_R1.ItemStack nmsItem) { super(nmsItem != null && nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound()); @@ -22,6 +23,17 @@ public class NBTItemImpl extends NBTCompoundImpl implements NBTItem { } } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + + @Override + public byte[] getByteArray(String tag) { + return new byte[0]; + } + @Override public void addExtras() { } diff --git a/NMS/NMS-v1_14_R1/src/com/songoda/core/nms/v1_14_R1/nbt/NBTObjectImpl.java b/NMS/NMS-v1_14_R1/src/com/songoda/core/nms/v1_14_R1/nbt/NBTObjectImpl.java index aa94d266..211f571a 100644 --- a/NMS/NMS-v1_14_R1/src/com/songoda/core/nms/v1_14_R1/nbt/NBTObjectImpl.java +++ b/NMS/NMS-v1_14_R1/src/com/songoda/core/nms/v1_14_R1/nbt/NBTObjectImpl.java @@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject { return compound.getIntArray(tag); } + @Override + public byte[] asByteArray() { + return compound.getByteArray(tag); + } + @Override public Set getKeys() { return compound.getKeys(); diff --git a/NMS/NMS-v1_15_R1/src/com/songoda/core/nms/v1_15_R1/nbt/NBTCompoundImpl.java b/NMS/NMS-v1_15_R1/src/com/songoda/core/nms/v1_15_R1/nbt/NBTCompoundImpl.java index 151bb463..2e603a1b 100644 --- a/NMS/NMS-v1_15_R1/src/com/songoda/core/nms/v1_15_R1/nbt/NBTCompoundImpl.java +++ b/NMS/NMS-v1_15_R1/src/com/songoda/core/nms/v1_15_R1/nbt/NBTCompoundImpl.java @@ -74,6 +74,12 @@ public class NBTCompoundImpl implements NBTCompound { return this; } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + @Override public NBTCompound set(String tag, UUID u) { compound.a(tag, u); @@ -136,6 +142,11 @@ public class NBTCompoundImpl implements NBTCompound { return getNBTObject(tag).asIntArray(); } + @Override + public byte[] getByteArray(String tag) { + return new byte[0]; + } + @Override public NBTCompound getCompound(String tag) { if (has(tag)) { diff --git a/NMS/NMS-v1_15_R1/src/com/songoda/core/nms/v1_15_R1/nbt/NBTEntityImpl.java b/NMS/NMS-v1_15_R1/src/com/songoda/core/nms/v1_15_R1/nbt/NBTEntityImpl.java index d6aa5256..9343e647 100644 --- a/NMS/NMS-v1_15_R1/src/com/songoda/core/nms/v1_15_R1/nbt/NBTEntityImpl.java +++ b/NMS/NMS-v1_15_R1/src/com/songoda/core/nms/v1_15_R1/nbt/NBTEntityImpl.java @@ -1,5 +1,6 @@ package com.songoda.core.nms.v1_15_R1.nbt; +import com.songoda.core.nms.nbt.NBTCompound; import com.songoda.core.nms.nbt.NBTEntity; import net.minecraft.server.v1_15_R1.BlockPosition; import net.minecraft.server.v1_15_R1.Entity; @@ -56,6 +57,17 @@ public class NBTEntityImpl extends NBTCompoundImpl implements NBTEntity { return spawn(location); } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + + @Override + public byte[] getByteArray(String tag) { + return new byte[0]; + } + @Override public void addExtras() { compound.setString("entity_type", IRegistry.ENTITY_TYPE.getKey(nmsEntity.getEntityType()).toString()); diff --git a/NMS/NMS-v1_15_R1/src/com/songoda/core/nms/v1_15_R1/nbt/NBTItemImpl.java b/NMS/NMS-v1_15_R1/src/com/songoda/core/nms/v1_15_R1/nbt/NBTItemImpl.java index c71b27d8..dbd5f2f0 100644 --- a/NMS/NMS-v1_15_R1/src/com/songoda/core/nms/v1_15_R1/nbt/NBTItemImpl.java +++ b/NMS/NMS-v1_15_R1/src/com/songoda/core/nms/v1_15_R1/nbt/NBTItemImpl.java @@ -7,7 +7,7 @@ import org.bukkit.inventory.ItemStack; public class NBTItemImpl extends NBTCompoundImpl implements NBTItem { - private net.minecraft.server.v1_15_R1.ItemStack nmsItem; + private final net.minecraft.server.v1_15_R1.ItemStack nmsItem; public NBTItemImpl(net.minecraft.server.v1_15_R1.ItemStack nmsItem) { super(nmsItem != null && nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound()); diff --git a/NMS/NMS-v1_15_R1/src/com/songoda/core/nms/v1_15_R1/nbt/NBTObjectImpl.java b/NMS/NMS-v1_15_R1/src/com/songoda/core/nms/v1_15_R1/nbt/NBTObjectImpl.java index 3a76e153..8f85aea4 100644 --- a/NMS/NMS-v1_15_R1/src/com/songoda/core/nms/v1_15_R1/nbt/NBTObjectImpl.java +++ b/NMS/NMS-v1_15_R1/src/com/songoda/core/nms/v1_15_R1/nbt/NBTObjectImpl.java @@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject { return compound.getIntArray(tag); } + @Override + public byte[] asByteArray() { + return compound.getByteArray(tag); + } + @Override public Set getKeys() { return compound.getKeys(); diff --git a/NMS/NMS-v1_16_R1/src/com/songoda/core/nms/v1_16_R1/nbt/NBTCompoundImpl.java b/NMS/NMS-v1_16_R1/src/com/songoda/core/nms/v1_16_R1/nbt/NBTCompoundImpl.java index a243dac1..76f6533b 100644 --- a/NMS/NMS-v1_16_R1/src/com/songoda/core/nms/v1_16_R1/nbt/NBTCompoundImpl.java +++ b/NMS/NMS-v1_16_R1/src/com/songoda/core/nms/v1_16_R1/nbt/NBTCompoundImpl.java @@ -74,6 +74,12 @@ public class NBTCompoundImpl implements NBTCompound { return this; } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + @Override public NBTCompound set(String tag, UUID u) { compound.a(tag, u); @@ -136,6 +142,11 @@ public class NBTCompoundImpl implements NBTCompound { return getNBTObject(tag).asIntArray(); } + @Override + public byte[] getByteArray(String tag) { + return new byte[0]; + } + @Override public NBTCompound getCompound(String tag) { if (has(tag)) { diff --git a/NMS/NMS-v1_16_R1/src/com/songoda/core/nms/v1_16_R1/nbt/NBTItemImpl.java b/NMS/NMS-v1_16_R1/src/com/songoda/core/nms/v1_16_R1/nbt/NBTItemImpl.java index dcd91660..8ee25e9a 100644 --- a/NMS/NMS-v1_16_R1/src/com/songoda/core/nms/v1_16_R1/nbt/NBTItemImpl.java +++ b/NMS/NMS-v1_16_R1/src/com/songoda/core/nms/v1_16_R1/nbt/NBTItemImpl.java @@ -1,5 +1,6 @@ package com.songoda.core.nms.v1_16_R1.nbt; +import com.songoda.core.nms.nbt.NBTCompound; import com.songoda.core.nms.nbt.NBTItem; import net.minecraft.server.v1_16_R1.NBTTagCompound; import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack; @@ -7,7 +8,7 @@ import org.bukkit.inventory.ItemStack; public class NBTItemImpl extends NBTCompoundImpl implements NBTItem { - private net.minecraft.server.v1_16_R1.ItemStack nmsItem; + private final net.minecraft.server.v1_16_R1.ItemStack nmsItem; public NBTItemImpl(net.minecraft.server.v1_16_R1.ItemStack nmsItem) { super(nmsItem != null && nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound()); @@ -22,6 +23,17 @@ public class NBTItemImpl extends NBTCompoundImpl implements NBTItem { } } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + + @Override + public byte[] getByteArray(String tag) { + return new byte[0]; + } + @Override public void addExtras() { } diff --git a/NMS/NMS-v1_16_R1/src/com/songoda/core/nms/v1_16_R1/nbt/NBTObjectImpl.java b/NMS/NMS-v1_16_R1/src/com/songoda/core/nms/v1_16_R1/nbt/NBTObjectImpl.java index 31066453..3d2968c8 100644 --- a/NMS/NMS-v1_16_R1/src/com/songoda/core/nms/v1_16_R1/nbt/NBTObjectImpl.java +++ b/NMS/NMS-v1_16_R1/src/com/songoda/core/nms/v1_16_R1/nbt/NBTObjectImpl.java @@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject { return compound.getIntArray(tag); } + @Override + public byte[] asByteArray() { + return compound.getByteArray(tag); + } + @Override public Set getKeys() { return compound.getKeys(); diff --git a/NMS/NMS-v1_16_R2/src/com/songoda/core/nms/v1_16_R2/nbt/NBTCompoundImpl.java b/NMS/NMS-v1_16_R2/src/com/songoda/core/nms/v1_16_R2/nbt/NBTCompoundImpl.java index 8753b8be..04602891 100644 --- a/NMS/NMS-v1_16_R2/src/com/songoda/core/nms/v1_16_R2/nbt/NBTCompoundImpl.java +++ b/NMS/NMS-v1_16_R2/src/com/songoda/core/nms/v1_16_R2/nbt/NBTCompoundImpl.java @@ -74,6 +74,12 @@ public class NBTCompoundImpl implements NBTCompound { return this; } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + @Override public NBTCompound set(String tag, UUID u) { compound.a(tag, u); @@ -136,6 +142,11 @@ public class NBTCompoundImpl implements NBTCompound { return getNBTObject(tag).asIntArray(); } + @Override + public byte[] getByteArray(String tag) { + return new byte[0]; + } + @Override public NBTCompound getCompound(String tag) { if (has(tag)) { diff --git a/NMS/NMS-v1_16_R2/src/com/songoda/core/nms/v1_16_R2/nbt/NBTItemImpl.java b/NMS/NMS-v1_16_R2/src/com/songoda/core/nms/v1_16_R2/nbt/NBTItemImpl.java index 7fbaa568..488a07d4 100644 --- a/NMS/NMS-v1_16_R2/src/com/songoda/core/nms/v1_16_R2/nbt/NBTItemImpl.java +++ b/NMS/NMS-v1_16_R2/src/com/songoda/core/nms/v1_16_R2/nbt/NBTItemImpl.java @@ -7,7 +7,7 @@ import org.bukkit.inventory.ItemStack; public class NBTItemImpl extends NBTCompoundImpl implements NBTItem { - private net.minecraft.server.v1_16_R2.ItemStack nmsItem; + private final net.minecraft.server.v1_16_R2.ItemStack nmsItem; public NBTItemImpl(net.minecraft.server.v1_16_R2.ItemStack nmsItem) { super(nmsItem != null && nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound()); diff --git a/NMS/NMS-v1_16_R2/src/com/songoda/core/nms/v1_16_R2/nbt/NBTObjectImpl.java b/NMS/NMS-v1_16_R2/src/com/songoda/core/nms/v1_16_R2/nbt/NBTObjectImpl.java index 66af4f6e..b0a06f1d 100644 --- a/NMS/NMS-v1_16_R2/src/com/songoda/core/nms/v1_16_R2/nbt/NBTObjectImpl.java +++ b/NMS/NMS-v1_16_R2/src/com/songoda/core/nms/v1_16_R2/nbt/NBTObjectImpl.java @@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject { return compound.getIntArray(tag); } + @Override + public byte[] asByteArray() { + return compound.getByteArray(tag); + } + @Override public NBTCompound asCompound() { return new NBTCompoundImpl(compound.getCompound(tag)); diff --git a/NMS/NMS-v1_16_R3/src/com/songoda/core/nms/v1_16_R3/nbt/NBTCompoundImpl.java b/NMS/NMS-v1_16_R3/src/com/songoda/core/nms/v1_16_R3/nbt/NBTCompoundImpl.java index 031640ed..65e07866 100644 --- a/NMS/NMS-v1_16_R3/src/com/songoda/core/nms/v1_16_R3/nbt/NBTCompoundImpl.java +++ b/NMS/NMS-v1_16_R3/src/com/songoda/core/nms/v1_16_R3/nbt/NBTCompoundImpl.java @@ -74,6 +74,12 @@ public class NBTCompoundImpl implements NBTCompound { return this; } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + @Override public NBTCompound set(String tag, UUID u) { compound.a(tag, u); @@ -136,6 +142,11 @@ public class NBTCompoundImpl implements NBTCompound { return getNBTObject(tag).asIntArray(); } + @Override + public byte[] getByteArray(String tag) { + return getNBTObject(tag).asByteArray(); + } + @Override public NBTCompound getCompound(String tag) { if (has(tag)) { diff --git a/NMS/NMS-v1_16_R3/src/com/songoda/core/nms/v1_16_R3/nbt/NBTItemImpl.java b/NMS/NMS-v1_16_R3/src/com/songoda/core/nms/v1_16_R3/nbt/NBTItemImpl.java index 97bac649..26089a9d 100644 --- a/NMS/NMS-v1_16_R3/src/com/songoda/core/nms/v1_16_R3/nbt/NBTItemImpl.java +++ b/NMS/NMS-v1_16_R3/src/com/songoda/core/nms/v1_16_R3/nbt/NBTItemImpl.java @@ -13,7 +13,7 @@ import java.io.IOException; public class NBTItemImpl extends NBTCompoundImpl implements NBTItem { - private net.minecraft.server.v1_16_R3.ItemStack nmsItem; + private final net.minecraft.server.v1_16_R3.ItemStack nmsItem; public NBTItemImpl(net.minecraft.server.v1_16_R3.ItemStack nmsItem) { super(nmsItem != null && nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound()); @@ -28,29 +28,6 @@ public class NBTItemImpl extends NBTCompoundImpl implements NBTItem { } } - - @Override - public byte[] serialize(String... exclusions) { - try (ByteArrayOutputStream stream = new ByteArrayOutputStream(); BukkitObjectOutputStream bukkitStream = new BukkitObjectOutputStream(stream)) { - bukkitStream.writeObject(nmsItem); - return stream.toByteArray(); - } catch (IOException e) { - e.printStackTrace(); - return null; - } - } - - @Override - public void deSerialize(byte[] serialized) { - try (BukkitObjectInputStream stream = new BukkitObjectInputStream( - new ByteArrayInputStream(serialized))) { - nmsItem = (net.minecraft.server.v1_16_R3.ItemStack) stream.readObject(); - } catch (IOException | ClassNotFoundException e) { - e.printStackTrace(); - } - - } - @Override public void addExtras() { } diff --git a/NMS/NMS-v1_16_R3/src/com/songoda/core/nms/v1_16_R3/nbt/NBTObjectImpl.java b/NMS/NMS-v1_16_R3/src/com/songoda/core/nms/v1_16_R3/nbt/NBTObjectImpl.java index bb3f2b08..56af357c 100644 --- a/NMS/NMS-v1_16_R3/src/com/songoda/core/nms/v1_16_R3/nbt/NBTObjectImpl.java +++ b/NMS/NMS-v1_16_R3/src/com/songoda/core/nms/v1_16_R3/nbt/NBTObjectImpl.java @@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject { return compound.getIntArray(tag); } + @Override + public byte[] asByteArray() { + return compound.getByteArray(tag); + } + @Override public NBTCompound asCompound() { return new NBTCompoundImpl(compound.getCompound(tag)); diff --git a/NMS/NMS-v1_8_R1/src/com/songoda/core/nms/v1_8_R1/nbt/NBTCompoundImpl.java b/NMS/NMS-v1_8_R1/src/com/songoda/core/nms/v1_8_R1/nbt/NBTCompoundImpl.java index 94dcd1d1..b96e2a68 100644 --- a/NMS/NMS-v1_8_R1/src/com/songoda/core/nms/v1_8_R1/nbt/NBTCompoundImpl.java +++ b/NMS/NMS-v1_8_R1/src/com/songoda/core/nms/v1_8_R1/nbt/NBTCompoundImpl.java @@ -74,6 +74,12 @@ public class NBTCompoundImpl implements NBTCompound { return this; } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + @Override public NBTCompound set(String tag, UUID u) { set(tag + "Most", u.getMostSignificantBits()); @@ -137,6 +143,11 @@ public class NBTCompoundImpl implements NBTCompound { return getNBTObject(tag).asIntArray(); } + @Override + public byte[] getByteArray(String tag) { + return new byte[0]; + } + @Override public NBTCompound getCompound(String tag) { if (has(tag)) { diff --git a/NMS/NMS-v1_8_R1/src/com/songoda/core/nms/v1_8_R1/nbt/NBTItemImpl.java b/NMS/NMS-v1_8_R1/src/com/songoda/core/nms/v1_8_R1/nbt/NBTItemImpl.java index ce8dfd93..4df19aa6 100644 --- a/NMS/NMS-v1_8_R1/src/com/songoda/core/nms/v1_8_R1/nbt/NBTItemImpl.java +++ b/NMS/NMS-v1_8_R1/src/com/songoda/core/nms/v1_8_R1/nbt/NBTItemImpl.java @@ -7,7 +7,7 @@ import org.bukkit.inventory.ItemStack; public class NBTItemImpl extends NBTCompoundImpl implements NBTItem { - private net.minecraft.server.v1_8_R1.ItemStack nmsItem; + private final net.minecraft.server.v1_8_R1.ItemStack nmsItem; public NBTItemImpl(net.minecraft.server.v1_8_R1.ItemStack nmsItem) { super(nmsItem != null && nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound()); diff --git a/NMS/NMS-v1_8_R1/src/com/songoda/core/nms/v1_8_R1/nbt/NBTObjectImpl.java b/NMS/NMS-v1_8_R1/src/com/songoda/core/nms/v1_8_R1/nbt/NBTObjectImpl.java index 17a00912..235cb615 100644 --- a/NMS/NMS-v1_8_R1/src/com/songoda/core/nms/v1_8_R1/nbt/NBTObjectImpl.java +++ b/NMS/NMS-v1_8_R1/src/com/songoda/core/nms/v1_8_R1/nbt/NBTObjectImpl.java @@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject { return compound.getIntArray(tag); } + @Override + public byte[] asByteArray() { + return compound.getByteArray(tag); + } + @Override public Set getKeys() { return compound.c(); diff --git a/NMS/NMS-v1_8_R2/src/com/songoda/core/nms/v1_8_R2/nbt/NBTCompoundImpl.java b/NMS/NMS-v1_8_R2/src/com/songoda/core/nms/v1_8_R2/nbt/NBTCompoundImpl.java index bc3e1186..f6acb2d2 100644 --- a/NMS/NMS-v1_8_R2/src/com/songoda/core/nms/v1_8_R2/nbt/NBTCompoundImpl.java +++ b/NMS/NMS-v1_8_R2/src/com/songoda/core/nms/v1_8_R2/nbt/NBTCompoundImpl.java @@ -74,6 +74,12 @@ public class NBTCompoundImpl implements NBTCompound { return this; } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + @Override public NBTCompound set(String tag, UUID u) { set(tag + "Most", u.getMostSignificantBits()); @@ -137,6 +143,11 @@ public class NBTCompoundImpl implements NBTCompound { return getNBTObject(tag).asIntArray(); } + @Override + public byte[] getByteArray(String tag) { + return new byte[0]; + } + @Override public NBTCompound getCompound(String tag) { if (has(tag)) { diff --git a/NMS/NMS-v1_8_R2/src/com/songoda/core/nms/v1_8_R2/nbt/NBTItemImpl.java b/NMS/NMS-v1_8_R2/src/com/songoda/core/nms/v1_8_R2/nbt/NBTItemImpl.java index 748bd485..d44d6952 100644 --- a/NMS/NMS-v1_8_R2/src/com/songoda/core/nms/v1_8_R2/nbt/NBTItemImpl.java +++ b/NMS/NMS-v1_8_R2/src/com/songoda/core/nms/v1_8_R2/nbt/NBTItemImpl.java @@ -7,7 +7,7 @@ import org.bukkit.inventory.ItemStack; public class NBTItemImpl extends NBTCompoundImpl implements NBTItem { - private net.minecraft.server.v1_8_R2.ItemStack nmsItem; + private final net.minecraft.server.v1_8_R2.ItemStack nmsItem; public NBTItemImpl(net.minecraft.server.v1_8_R2.ItemStack nmsItem) { super(nmsItem != null && nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound()); diff --git a/NMS/NMS-v1_8_R2/src/com/songoda/core/nms/v1_8_R2/nbt/NBTObjectImpl.java b/NMS/NMS-v1_8_R2/src/com/songoda/core/nms/v1_8_R2/nbt/NBTObjectImpl.java index 05154e13..deaf3e4d 100644 --- a/NMS/NMS-v1_8_R2/src/com/songoda/core/nms/v1_8_R2/nbt/NBTObjectImpl.java +++ b/NMS/NMS-v1_8_R2/src/com/songoda/core/nms/v1_8_R2/nbt/NBTObjectImpl.java @@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject { return compound.getIntArray(tag); } + @Override + public byte[] asByteArray() { + return compound.getByteArray(tag); + } + @Override public Set getKeys() { return compound.c(); diff --git a/NMS/NMS-v1_8_R3/src/com/songoda/core/nms/v1_8_R3/nbt/NBTCompoundImpl.java b/NMS/NMS-v1_8_R3/src/com/songoda/core/nms/v1_8_R3/nbt/NBTCompoundImpl.java index ebc03afb..76ab7449 100644 --- a/NMS/NMS-v1_8_R3/src/com/songoda/core/nms/v1_8_R3/nbt/NBTCompoundImpl.java +++ b/NMS/NMS-v1_8_R3/src/com/songoda/core/nms/v1_8_R3/nbt/NBTCompoundImpl.java @@ -74,6 +74,12 @@ public class NBTCompoundImpl implements NBTCompound { return this; } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + @Override public NBTCompound set(String tag, UUID u) { set(tag + "Most", u.getMostSignificantBits()); @@ -137,6 +143,11 @@ public class NBTCompoundImpl implements NBTCompound { return getNBTObject(tag).asIntArray(); } + @Override + public byte[] getByteArray(String tag) { + return new byte[0]; + } + @Override public NBTCompound getCompound(String tag) { if (has(tag)) { diff --git a/NMS/NMS-v1_8_R3/src/com/songoda/core/nms/v1_8_R3/nbt/NBTEntityImpl.java b/NMS/NMS-v1_8_R3/src/com/songoda/core/nms/v1_8_R3/nbt/NBTEntityImpl.java index 56b1ca93..ab324c78 100644 --- a/NMS/NMS-v1_8_R3/src/com/songoda/core/nms/v1_8_R3/nbt/NBTEntityImpl.java +++ b/NMS/NMS-v1_8_R3/src/com/songoda/core/nms/v1_8_R3/nbt/NBTEntityImpl.java @@ -1,5 +1,6 @@ package com.songoda.core.nms.v1_8_R3.nbt; +import com.songoda.core.nms.nbt.NBTCompound; import com.songoda.core.nms.nbt.NBTEntity; import net.minecraft.server.v1_8_R3.Entity; import net.minecraft.server.v1_8_R3.EntityTypes; @@ -65,6 +66,17 @@ public class NBTEntityImpl extends NBTCompoundImpl implements NBTEntity { return spawn(location); } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + + @Override + public byte[] getByteArray(String tag) { + return new byte[0]; + } + @Override public void addExtras() { String key = EntityTypes.b(nmsEntity); // Changed in 1.12 diff --git a/NMS/NMS-v1_8_R3/src/com/songoda/core/nms/v1_8_R3/nbt/NBTItemImpl.java b/NMS/NMS-v1_8_R3/src/com/songoda/core/nms/v1_8_R3/nbt/NBTItemImpl.java index e7e3e064..181c5e3d 100644 --- a/NMS/NMS-v1_8_R3/src/com/songoda/core/nms/v1_8_R3/nbt/NBTItemImpl.java +++ b/NMS/NMS-v1_8_R3/src/com/songoda/core/nms/v1_8_R3/nbt/NBTItemImpl.java @@ -7,7 +7,7 @@ import org.bukkit.inventory.ItemStack; public class NBTItemImpl extends NBTCompoundImpl implements NBTItem { - private net.minecraft.server.v1_8_R3.ItemStack nmsItem; + private final net.minecraft.server.v1_8_R3.ItemStack nmsItem; public NBTItemImpl(net.minecraft.server.v1_8_R3.ItemStack nmsItem) { super(nmsItem != null && nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound()); diff --git a/NMS/NMS-v1_8_R3/src/com/songoda/core/nms/v1_8_R3/nbt/NBTObjectImpl.java b/NMS/NMS-v1_8_R3/src/com/songoda/core/nms/v1_8_R3/nbt/NBTObjectImpl.java index cc109ceb..1ee72562 100644 --- a/NMS/NMS-v1_8_R3/src/com/songoda/core/nms/v1_8_R3/nbt/NBTObjectImpl.java +++ b/NMS/NMS-v1_8_R3/src/com/songoda/core/nms/v1_8_R3/nbt/NBTObjectImpl.java @@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject { return compound.getIntArray(tag); } + @Override + public byte[] asByteArray() { + return compound.getByteArray(tag); + } + @Override public Set getKeys() { return compound.c(); diff --git a/NMS/NMS-v1_9_R1/src/com/songoda/core/nms/v1_9_R1/nbt/NBTCompoundImpl.java b/NMS/NMS-v1_9_R1/src/com/songoda/core/nms/v1_9_R1/nbt/NBTCompoundImpl.java index ce83f25d..523a568d 100644 --- a/NMS/NMS-v1_9_R1/src/com/songoda/core/nms/v1_9_R1/nbt/NBTCompoundImpl.java +++ b/NMS/NMS-v1_9_R1/src/com/songoda/core/nms/v1_9_R1/nbt/NBTCompoundImpl.java @@ -74,6 +74,12 @@ public class NBTCompoundImpl implements NBTCompound { return this; } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + @Override public NBTCompound set(String tag, UUID u) { compound.a(tag, u); @@ -136,6 +142,11 @@ public class NBTCompoundImpl implements NBTCompound { return getNBTObject(tag).asIntArray(); } + @Override + public byte[] getByteArray(String tag) { + return new byte[0]; + } + @Override public NBTCompound getCompound(String tag) { if (has(tag)) { diff --git a/NMS/NMS-v1_9_R1/src/com/songoda/core/nms/v1_9_R1/nbt/NBTItemImpl.java b/NMS/NMS-v1_9_R1/src/com/songoda/core/nms/v1_9_R1/nbt/NBTItemImpl.java index 1bbfddd2..701630de 100644 --- a/NMS/NMS-v1_9_R1/src/com/songoda/core/nms/v1_9_R1/nbt/NBTItemImpl.java +++ b/NMS/NMS-v1_9_R1/src/com/songoda/core/nms/v1_9_R1/nbt/NBTItemImpl.java @@ -7,7 +7,7 @@ import org.bukkit.inventory.ItemStack; public class NBTItemImpl extends NBTCompoundImpl implements NBTItem { - private net.minecraft.server.v1_9_R1.ItemStack nmsItem; + private final net.minecraft.server.v1_9_R1.ItemStack nmsItem; public NBTItemImpl(net.minecraft.server.v1_9_R1.ItemStack nmsItem) { super(nmsItem != null && nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound()); diff --git a/NMS/NMS-v1_9_R1/src/com/songoda/core/nms/v1_9_R1/nbt/NBTObjectImpl.java b/NMS/NMS-v1_9_R1/src/com/songoda/core/nms/v1_9_R1/nbt/NBTObjectImpl.java index e77cf650..7af6dab3 100644 --- a/NMS/NMS-v1_9_R1/src/com/songoda/core/nms/v1_9_R1/nbt/NBTObjectImpl.java +++ b/NMS/NMS-v1_9_R1/src/com/songoda/core/nms/v1_9_R1/nbt/NBTObjectImpl.java @@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject { return compound.getIntArray(tag); } + @Override + public byte[] asByteArray() { + return compound.getByteArray(tag); + } + @Override public Set getKeys() { return compound.c(); diff --git a/NMS/NMS-v1_9_R2/src/com/songoda/core/nms/v1_9_R2/nbt/NBTCompoundImpl.java b/NMS/NMS-v1_9_R2/src/com/songoda/core/nms/v1_9_R2/nbt/NBTCompoundImpl.java index 4997b32d..fbc55232 100644 --- a/NMS/NMS-v1_9_R2/src/com/songoda/core/nms/v1_9_R2/nbt/NBTCompoundImpl.java +++ b/NMS/NMS-v1_9_R2/src/com/songoda/core/nms/v1_9_R2/nbt/NBTCompoundImpl.java @@ -74,6 +74,12 @@ public class NBTCompoundImpl implements NBTCompound { return this; } + @Override + public NBTCompound set(String tag, byte[] b) { + compound.setByteArray(tag, b); + return this; + } + @Override public NBTCompound set(String tag, UUID u) { compound.a(tag, u); @@ -136,6 +142,11 @@ public class NBTCompoundImpl implements NBTCompound { return getNBTObject(tag).asIntArray(); } + @Override + public byte[] getByteArray(String tag) { + return new byte[0]; + } + @Override public NBTCompound getCompound(String tag) { if (has(tag)) { diff --git a/NMS/NMS-v1_9_R2/src/com/songoda/core/nms/v1_9_R2/nbt/NBTItemImpl.java b/NMS/NMS-v1_9_R2/src/com/songoda/core/nms/v1_9_R2/nbt/NBTItemImpl.java index ec7386ad..fedf0fe6 100644 --- a/NMS/NMS-v1_9_R2/src/com/songoda/core/nms/v1_9_R2/nbt/NBTItemImpl.java +++ b/NMS/NMS-v1_9_R2/src/com/songoda/core/nms/v1_9_R2/nbt/NBTItemImpl.java @@ -7,7 +7,7 @@ import org.bukkit.inventory.ItemStack; public class NBTItemImpl extends NBTCompoundImpl implements NBTItem { - private net.minecraft.server.v1_9_R2.ItemStack nmsItem; + private final net.minecraft.server.v1_9_R2.ItemStack nmsItem; public NBTItemImpl(net.minecraft.server.v1_9_R2.ItemStack nmsItem) { super(nmsItem != null && nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound()); diff --git a/NMS/NMS-v1_9_R2/src/com/songoda/core/nms/v1_9_R2/nbt/NBTObjectImpl.java b/NMS/NMS-v1_9_R2/src/com/songoda/core/nms/v1_9_R2/nbt/NBTObjectImpl.java index 71c79faf..5e2e339c 100644 --- a/NMS/NMS-v1_9_R2/src/com/songoda/core/nms/v1_9_R2/nbt/NBTObjectImpl.java +++ b/NMS/NMS-v1_9_R2/src/com/songoda/core/nms/v1_9_R2/nbt/NBTObjectImpl.java @@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject { return compound.getIntArray(tag); } + @Override + public byte[] asByteArray() { + return compound.getByteArray(tag); + } + @Override public Set getKeys() { return compound.c();