mirror of
https://github.com/songoda/SongodaCore.git
synced 2024-11-23 10:35:18 +01:00
Added byte arrays to the nbt api.
This commit is contained in:
parent
9b9f0b9a52
commit
75c11b19a7
@ -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<String> getKeys();
|
||||
|
@ -20,6 +20,8 @@ public interface NBTObject {
|
||||
|
||||
int[] asIntArray();
|
||||
|
||||
byte[] asByteArray();
|
||||
|
||||
Set<String> getKeys();
|
||||
|
||||
NBTCompound asCompound();
|
||||
|
@ -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)) {
|
||||
|
@ -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());
|
||||
|
@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject {
|
||||
return compound.getIntArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] asByteArray() {
|
||||
return compound.getByteArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getKeys() {
|
||||
return compound.c();
|
||||
|
@ -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)) {
|
||||
|
@ -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() {
|
||||
}
|
||||
|
@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject {
|
||||
return compound.getIntArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] asByteArray() {
|
||||
return compound.getByteArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getKeys() {
|
||||
return compound.c();
|
||||
|
@ -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)) {
|
||||
|
@ -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());
|
||||
|
@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject {
|
||||
return compound.getIntArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] asByteArray() {
|
||||
return compound.getByteArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getKeys() {
|
||||
return compound.c();
|
||||
|
@ -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)) {
|
||||
|
@ -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());
|
||||
|
@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject {
|
||||
return compound.getIntArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] asByteArray() {
|
||||
return compound.getByteArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getKeys() {
|
||||
return compound.getKeys();
|
||||
|
@ -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)) {
|
||||
|
@ -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() {
|
||||
}
|
||||
|
@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject {
|
||||
return compound.getIntArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] asByteArray() {
|
||||
return compound.getByteArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getKeys() {
|
||||
return compound.getKeys();
|
||||
|
@ -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)) {
|
||||
|
@ -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() {
|
||||
}
|
||||
|
@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject {
|
||||
return compound.getIntArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] asByteArray() {
|
||||
return compound.getByteArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getKeys() {
|
||||
return compound.getKeys();
|
||||
|
@ -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)) {
|
||||
|
@ -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());
|
||||
|
@ -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());
|
||||
|
@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject {
|
||||
return compound.getIntArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] asByteArray() {
|
||||
return compound.getByteArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getKeys() {
|
||||
return compound.getKeys();
|
||||
|
@ -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)) {
|
||||
|
@ -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() {
|
||||
}
|
||||
|
@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject {
|
||||
return compound.getIntArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] asByteArray() {
|
||||
return compound.getByteArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getKeys() {
|
||||
return compound.getKeys();
|
||||
|
@ -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)) {
|
||||
|
@ -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());
|
||||
|
@ -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));
|
||||
|
@ -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)) {
|
||||
|
@ -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() {
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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)) {
|
||||
|
@ -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());
|
||||
|
@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject {
|
||||
return compound.getIntArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] asByteArray() {
|
||||
return compound.getByteArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getKeys() {
|
||||
return compound.c();
|
||||
|
@ -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)) {
|
||||
|
@ -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());
|
||||
|
@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject {
|
||||
return compound.getIntArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] asByteArray() {
|
||||
return compound.getByteArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getKeys() {
|
||||
return compound.c();
|
||||
|
@ -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)) {
|
||||
|
@ -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
|
||||
|
@ -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());
|
||||
|
@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject {
|
||||
return compound.getIntArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] asByteArray() {
|
||||
return compound.getByteArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getKeys() {
|
||||
return compound.c();
|
||||
|
@ -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)) {
|
||||
|
@ -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());
|
||||
|
@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject {
|
||||
return compound.getIntArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] asByteArray() {
|
||||
return compound.getByteArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getKeys() {
|
||||
return compound.c();
|
||||
|
@ -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)) {
|
||||
|
@ -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());
|
||||
|
@ -56,6 +56,11 @@ public class NBTObjectImpl implements NBTObject {
|
||||
return compound.getIntArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] asByteArray() {
|
||||
return compound.getByteArray(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getKeys() {
|
||||
return compound.c();
|
||||
|
Loading…
Reference in New Issue
Block a user