NBT Updates.

This commit is contained in:
Brianna 2020-09-29 16:22:18 -05:00
parent 0755fadc00
commit 623a6b3120
29 changed files with 778 additions and 0 deletions

View File

@ -1,5 +1,6 @@
package com.songoda.core.nms.nbt;
import java.util.Set;
import java.util.UUID;
public interface NBTCompound {
@ -28,6 +29,24 @@ public interface NBTCompound {
NBTObject getNBTObject(String tag);
String getString(String tag);
boolean getBoolean(String tag);
int getInt(String tag);
double getDouble(String tag);
long getLong(String tag);
short getShort(String tag);
byte getByte(String tag);
int[] getIntArray(String tag);
Set<String> getKeys();
byte[] serialize(String... exclusions);
void deSerialize(byte[] serialized);

View File

@ -11,6 +11,7 @@ import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.Set;
import java.util.UUID;
public abstract class NBTCompoundImpl implements NBTCompound {
@ -95,6 +96,51 @@ public abstract class NBTCompoundImpl implements NBTCompound {
return new NBTObjectImpl(compound, tag);
}
@Override
public String getString(String tag) {
return getNBTObject(tag).asString();
}
@Override
public boolean getBoolean(String tag) {
return getNBTObject(tag).asBoolean();
}
@Override
public int getInt(String tag) {
return getNBTObject(tag).asInt();
}
@Override
public double getDouble(String tag) {
return getNBTObject(tag).asDouble();
}
@Override
public long getLong(String tag) {
return getNBTObject(tag).asLong();
}
@Override
public short getShort(String tag) {
return getNBTObject(tag).asShort();
}
@Override
public byte getByte(String tag) {
return getNBTObject(tag).asByte();
}
@Override
public int[] getIntArray(String tag) {
return getNBTObject(tag).asIntArray();
}
@Override
public Set<String> getKeys() {
return compound.c();
}
@Override
public byte[] serialize(String... exclusions) {
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

View File

@ -13,34 +13,42 @@ public class NBTObjectImpl implements NBTObject {
this.tag = tag;
}
@Override
public String asString() {
return compound.getString(tag);
}
@Override
public boolean asBoolean() {
return compound.getBoolean(tag);
}
@Override
public int asInt() {
return compound.getInt(tag);
}
@Override
public double asDouble() {
return compound.getDouble(tag);
}
@Override
public long asLong() {
return compound.getLong(tag);
}
@Override
public short asShort() {
return compound.getShort(tag);
}
@Override
public byte asByte() {
return compound.getByte(tag);
}
@Override
public int[] asIntArray() {
return compound.getIntArray(tag);
}

View File

@ -11,6 +11,7 @@ import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.Set;
import java.util.UUID;
public abstract class NBTCompoundImpl implements NBTCompound {
@ -95,6 +96,51 @@ public abstract class NBTCompoundImpl implements NBTCompound {
return new NBTObjectImpl(compound, tag);
}
@Override
public String getString(String tag) {
return getNBTObject(tag).asString();
}
@Override
public boolean getBoolean(String tag) {
return getNBTObject(tag).asBoolean();
}
@Override
public int getInt(String tag) {
return getNBTObject(tag).asInt();
}
@Override
public double getDouble(String tag) {
return getNBTObject(tag).asDouble();
}
@Override
public long getLong(String tag) {
return getNBTObject(tag).asLong();
}
@Override
public short getShort(String tag) {
return getNBTObject(tag).asShort();
}
@Override
public byte getByte(String tag) {
return getNBTObject(tag).asByte();
}
@Override
public int[] getIntArray(String tag) {
return getNBTObject(tag).asIntArray();
}
@Override
public Set<String> getKeys() {
return compound.c();
}
@Override
public byte[] serialize(String... exclusions) {
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

View File

@ -13,34 +13,42 @@ public class NBTObjectImpl implements NBTObject {
this.tag = tag;
}
@Override
public String asString() {
return compound.getString(tag);
}
@Override
public boolean asBoolean() {
return compound.getBoolean(tag);
}
@Override
public int asInt() {
return compound.getInt(tag);
}
@Override
public double asDouble() {
return compound.getDouble(tag);
}
@Override
public long asLong() {
return compound.getLong(tag);
}
@Override
public short asShort() {
return compound.getShort(tag);
}
@Override
public byte asByte() {
return compound.getByte(tag);
}
@Override
public int[] asIntArray() {
return compound.getIntArray(tag);
}

View File

@ -11,6 +11,7 @@ import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.Set;
import java.util.UUID;
public abstract class NBTCompoundImpl implements NBTCompound {
@ -95,6 +96,51 @@ public abstract class NBTCompoundImpl implements NBTCompound {
return new NBTObjectImpl(compound, tag);
}
@Override
public String getString(String tag) {
return getNBTObject(tag).asString();
}
@Override
public boolean getBoolean(String tag) {
return getNBTObject(tag).asBoolean();
}
@Override
public int getInt(String tag) {
return getNBTObject(tag).asInt();
}
@Override
public double getDouble(String tag) {
return getNBTObject(tag).asDouble();
}
@Override
public long getLong(String tag) {
return getNBTObject(tag).asLong();
}
@Override
public short getShort(String tag) {
return getNBTObject(tag).asShort();
}
@Override
public byte getByte(String tag) {
return getNBTObject(tag).asByte();
}
@Override
public int[] getIntArray(String tag) {
return getNBTObject(tag).asIntArray();
}
@Override
public Set<String> getKeys() {
return compound.c();
}
@Override
public byte[] serialize(String... exclusions) {
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

View File

@ -13,34 +13,42 @@ public class NBTObjectImpl implements NBTObject {
this.tag = tag;
}
@Override
public String asString() {
return compound.getString(tag);
}
@Override
public boolean asBoolean() {
return compound.getBoolean(tag);
}
@Override
public int asInt() {
return compound.getInt(tag);
}
@Override
public double asDouble() {
return compound.getDouble(tag);
}
@Override
public long asLong() {
return compound.getLong(tag);
}
@Override
public short asShort() {
return compound.getShort(tag);
}
@Override
public byte asByte() {
return compound.getByte(tag);
}
@Override
public int[] asIntArray() {
return compound.getIntArray(tag);
}

View File

@ -11,6 +11,7 @@ import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.Set;
import java.util.UUID;
public abstract class NBTCompoundImpl implements NBTCompound {
@ -95,6 +96,51 @@ public abstract class NBTCompoundImpl implements NBTCompound {
return new NBTObjectImpl(compound, tag);
}
@Override
public String getString(String tag) {
return getNBTObject(tag).asString();
}
@Override
public boolean getBoolean(String tag) {
return getNBTObject(tag).asBoolean();
}
@Override
public int getInt(String tag) {
return getNBTObject(tag).asInt();
}
@Override
public double getDouble(String tag) {
return getNBTObject(tag).asDouble();
}
@Override
public long getLong(String tag) {
return getNBTObject(tag).asLong();
}
@Override
public short getShort(String tag) {
return getNBTObject(tag).asShort();
}
@Override
public byte getByte(String tag) {
return getNBTObject(tag).asByte();
}
@Override
public int[] getIntArray(String tag) {
return getNBTObject(tag).asIntArray();
}
@Override
public Set<String> getKeys() {
return compound.getKeys();
}
@Override
public byte[] serialize(String... exclusions) {
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

View File

@ -13,34 +13,42 @@ public class NBTObjectImpl implements NBTObject {
this.tag = tag;
}
@Override
public String asString() {
return compound.getString(tag);
}
@Override
public boolean asBoolean() {
return compound.getBoolean(tag);
}
@Override
public int asInt() {
return compound.getInt(tag);
}
@Override
public double asDouble() {
return compound.getDouble(tag);
}
@Override
public long asLong() {
return compound.getLong(tag);
}
@Override
public short asShort() {
return compound.getShort(tag);
}
@Override
public byte asByte() {
return compound.getByte(tag);
}
@Override
public int[] asIntArray() {
return compound.getIntArray(tag);
}

View File

@ -11,6 +11,7 @@ import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.Set;
import java.util.UUID;
public abstract class NBTCompoundImpl implements NBTCompound {
@ -95,6 +96,51 @@ public abstract class NBTCompoundImpl implements NBTCompound {
return new NBTObjectImpl(compound, tag);
}
@Override
public String getString(String tag) {
return getNBTObject(tag).asString();
}
@Override
public boolean getBoolean(String tag) {
return getNBTObject(tag).asBoolean();
}
@Override
public int getInt(String tag) {
return getNBTObject(tag).asInt();
}
@Override
public double getDouble(String tag) {
return getNBTObject(tag).asDouble();
}
@Override
public long getLong(String tag) {
return getNBTObject(tag).asLong();
}
@Override
public short getShort(String tag) {
return getNBTObject(tag).asShort();
}
@Override
public byte getByte(String tag) {
return getNBTObject(tag).asByte();
}
@Override
public int[] getIntArray(String tag) {
return getNBTObject(tag).asIntArray();
}
@Override
public Set<String> getKeys() {
return compound.getKeys();
}
@Override
public byte[] serialize(String... exclusions) {
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

View File

@ -13,34 +13,42 @@ public class NBTObjectImpl implements NBTObject {
this.tag = tag;
}
@Override
public String asString() {
return compound.getString(tag);
}
@Override
public boolean asBoolean() {
return compound.getBoolean(tag);
}
@Override
public int asInt() {
return compound.getInt(tag);
}
@Override
public double asDouble() {
return compound.getDouble(tag);
}
@Override
public long asLong() {
return compound.getLong(tag);
}
@Override
public short asShort() {
return compound.getShort(tag);
}
@Override
public byte asByte() {
return compound.getByte(tag);
}
@Override
public int[] asIntArray() {
return compound.getIntArray(tag);
}

View File

@ -11,6 +11,7 @@ import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.Set;
import java.util.UUID;
public abstract class NBTCompoundImpl implements NBTCompound {
@ -95,6 +96,51 @@ public abstract class NBTCompoundImpl implements NBTCompound {
return new NBTObjectImpl(compound, tag);
}
@Override
public String getString(String tag) {
return getNBTObject(tag).asString();
}
@Override
public boolean getBoolean(String tag) {
return getNBTObject(tag).asBoolean();
}
@Override
public int getInt(String tag) {
return getNBTObject(tag).asInt();
}
@Override
public double getDouble(String tag) {
return getNBTObject(tag).asDouble();
}
@Override
public long getLong(String tag) {
return getNBTObject(tag).asLong();
}
@Override
public short getShort(String tag) {
return getNBTObject(tag).asShort();
}
@Override
public byte getByte(String tag) {
return getNBTObject(tag).asByte();
}
@Override
public int[] getIntArray(String tag) {
return getNBTObject(tag).asIntArray();
}
@Override
public Set<String> getKeys() {
return compound.getKeys();
}
@Override
public byte[] serialize(String... exclusions) {
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

View File

@ -13,36 +13,45 @@ public class NBTObjectImpl implements NBTObject {
this.tag = tag;
}
@Override
public String asString() {
return compound.getString(tag);
}
@Override
public boolean asBoolean() {
return compound.getBoolean(tag);
}
@Override
public int asInt() {
return compound.getInt(tag);
}
@Override
public double asDouble() {
return compound.getDouble(tag);
}
@Override
public long asLong() {
return compound.getLong(tag);
}
@Override
public short asShort() {
return compound.getShort(tag);
}
@Override
public byte asByte() {
return compound.getByte(tag);
}
@Override
public int[] asIntArray() {
return compound.getIntArray(tag);
}
}

View File

@ -11,6 +11,7 @@ import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.Set;
import java.util.UUID;
public abstract class NBTCompoundImpl implements NBTCompound {
@ -95,6 +96,51 @@ public abstract class NBTCompoundImpl implements NBTCompound {
return new NBTObjectImpl(compound, tag);
}
@Override
public String getString(String tag) {
return getNBTObject(tag).asString();
}
@Override
public boolean getBoolean(String tag) {
return getNBTObject(tag).asBoolean();
}
@Override
public int getInt(String tag) {
return getNBTObject(tag).asInt();
}
@Override
public double getDouble(String tag) {
return getNBTObject(tag).asDouble();
}
@Override
public long getLong(String tag) {
return getNBTObject(tag).asLong();
}
@Override
public short getShort(String tag) {
return getNBTObject(tag).asShort();
}
@Override
public byte getByte(String tag) {
return getNBTObject(tag).asByte();
}
@Override
public int[] getIntArray(String tag) {
return getNBTObject(tag).asIntArray();
}
@Override
public Set<String> getKeys() {
return compound.getKeys();
}
@Override
public byte[] serialize(String... exclusions) {
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

View File

@ -13,34 +13,42 @@ public class NBTObjectImpl implements NBTObject {
this.tag = tag;
}
@Override
public String asString() {
return compound.getString(tag);
}
@Override
public boolean asBoolean() {
return compound.getBoolean(tag);
}
@Override
public int asInt() {
return compound.getInt(tag);
}
@Override
public double asDouble() {
return compound.getDouble(tag);
}
@Override
public long asLong() {
return compound.getLong(tag);
}
@Override
public short asShort() {
return compound.getShort(tag);
}
@Override
public byte asByte() {
return compound.getByte(tag);
}
@Override
public int[] asIntArray() {
return compound.getIntArray(tag);
}

View File

@ -11,6 +11,7 @@ import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.Set;
import java.util.UUID;
public abstract class NBTCompoundImpl implements NBTCompound {
@ -95,6 +96,51 @@ public abstract class NBTCompoundImpl implements NBTCompound {
return new NBTObjectImpl(compound, tag);
}
@Override
public String getString(String tag) {
return getNBTObject(tag).asString();
}
@Override
public boolean getBoolean(String tag) {
return getNBTObject(tag).asBoolean();
}
@Override
public int getInt(String tag) {
return getNBTObject(tag).asInt();
}
@Override
public double getDouble(String tag) {
return getNBTObject(tag).asDouble();
}
@Override
public long getLong(String tag) {
return getNBTObject(tag).asLong();
}
@Override
public short getShort(String tag) {
return getNBTObject(tag).asShort();
}
@Override
public byte getByte(String tag) {
return getNBTObject(tag).asByte();
}
@Override
public int[] getIntArray(String tag) {
return getNBTObject(tag).asIntArray();
}
@Override
public Set<String> getKeys() {
return compound.getKeys();
}
@Override
public byte[] serialize(String... exclusions) {
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

View File

@ -13,34 +13,42 @@ public class NBTObjectImpl implements NBTObject {
this.tag = tag;
}
@Override
public String asString() {
return compound.getString(tag);
}
@Override
public boolean asBoolean() {
return compound.getBoolean(tag);
}
@Override
public int asInt() {
return compound.getInt(tag);
}
@Override
public double asDouble() {
return compound.getDouble(tag);
}
@Override
public long asLong() {
return compound.getLong(tag);
}
@Override
public short asShort() {
return compound.getShort(tag);
}
@Override
public byte asByte() {
return compound.getByte(tag);
}
@Override
public int[] asIntArray() {
return compound.getIntArray(tag);
}

View File

@ -11,6 +11,7 @@ import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.Set;
import java.util.UUID;
public abstract class NBTCompoundImpl implements NBTCompound {
@ -95,6 +96,51 @@ public abstract class NBTCompoundImpl implements NBTCompound {
return new NBTObjectImpl(compound, tag);
}
@Override
public String getString(String tag) {
return getNBTObject(tag).asString();
}
@Override
public boolean getBoolean(String tag) {
return getNBTObject(tag).asBoolean();
}
@Override
public int getInt(String tag) {
return getNBTObject(tag).asInt();
}
@Override
public double getDouble(String tag) {
return getNBTObject(tag).asDouble();
}
@Override
public long getLong(String tag) {
return getNBTObject(tag).asLong();
}
@Override
public short getShort(String tag) {
return getNBTObject(tag).asShort();
}
@Override
public byte getByte(String tag) {
return getNBTObject(tag).asByte();
}
@Override
public int[] getIntArray(String tag) {
return getNBTObject(tag).asIntArray();
}
@Override
public Set<String> getKeys() {
return compound.getKeys();
}
@Override
public byte[] serialize(String... exclusions) {
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

View File

@ -3,6 +3,8 @@ package com.songoda.core.nms.v1_16_R2.nbt;
import com.songoda.core.nms.nbt.NBTObject;
import net.minecraft.server.v1_16_R2.NBTTagCompound;
import java.util.Set;
public class NBTObjectImpl implements NBTObject {
private final NBTTagCompound compound;
@ -13,34 +15,42 @@ public class NBTObjectImpl implements NBTObject {
this.tag = tag;
}
@Override
public String asString() {
return compound.getString(tag);
}
@Override
public boolean asBoolean() {
return compound.getBoolean(tag);
}
@Override
public int asInt() {
return compound.getInt(tag);
}
@Override
public double asDouble() {
return compound.getDouble(tag);
}
@Override
public long asLong() {
return compound.getLong(tag);
}
@Override
public short asShort() {
return compound.getShort(tag);
}
@Override
public byte asByte() {
return compound.getByte(tag);
}
@Override
public int[] asIntArray() {
return compound.getIntArray(tag);
}

View File

@ -11,6 +11,7 @@ import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.Set;
import java.util.UUID;
public abstract class NBTCompoundImpl implements NBTCompound {
@ -96,6 +97,51 @@ public abstract class NBTCompoundImpl implements NBTCompound {
return new NBTObjectImpl(compound, tag);
}
@Override
public String getString(String tag) {
return getNBTObject(tag).asString();
}
@Override
public boolean getBoolean(String tag) {
return getNBTObject(tag).asBoolean();
}
@Override
public int getInt(String tag) {
return getNBTObject(tag).asInt();
}
@Override
public double getDouble(String tag) {
return getNBTObject(tag).asDouble();
}
@Override
public long getLong(String tag) {
return getNBTObject(tag).asLong();
}
@Override
public short getShort(String tag) {
return getNBTObject(tag).asShort();
}
@Override
public byte getByte(String tag) {
return getNBTObject(tag).asByte();
}
@Override
public int[] getIntArray(String tag) {
return getNBTObject(tag).asIntArray();
}
@Override
public Set<String> getKeys() {
return compound.c();
}
@Override
public byte[] serialize(String... exclusions) {
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

View File

@ -13,34 +13,42 @@ public class NBTObjectImpl implements NBTObject {
this.tag = tag;
}
@Override
public String asString() {
return compound.getString(tag);
}
@Override
public boolean asBoolean() {
return compound.getBoolean(tag);
}
@Override
public int asInt() {
return compound.getInt(tag);
}
@Override
public double asDouble() {
return compound.getDouble(tag);
}
@Override
public long asLong() {
return compound.getLong(tag);
}
@Override
public short asShort() {
return compound.getShort(tag);
}
@Override
public byte asByte() {
return compound.getByte(tag);
}
@Override
public int[] asIntArray() {
return compound.getIntArray(tag);
}

View File

@ -11,6 +11,7 @@ import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.Set;
import java.util.UUID;
public abstract class NBTCompoundImpl implements NBTCompound {
@ -96,6 +97,51 @@ public abstract class NBTCompoundImpl implements NBTCompound {
return new NBTObjectImpl(compound, tag);
}
@Override
public String getString(String tag) {
return getNBTObject(tag).asString();
}
@Override
public boolean getBoolean(String tag) {
return getNBTObject(tag).asBoolean();
}
@Override
public int getInt(String tag) {
return getNBTObject(tag).asInt();
}
@Override
public double getDouble(String tag) {
return getNBTObject(tag).asDouble();
}
@Override
public long getLong(String tag) {
return getNBTObject(tag).asLong();
}
@Override
public short getShort(String tag) {
return getNBTObject(tag).asShort();
}
@Override
public byte getByte(String tag) {
return getNBTObject(tag).asByte();
}
@Override
public int[] getIntArray(String tag) {
return getNBTObject(tag).asIntArray();
}
@Override
public Set<String> getKeys() {
return compound.c();
}
@Override
public byte[] serialize(String... exclusions) {
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

View File

@ -13,34 +13,42 @@ public class NBTObjectImpl implements NBTObject {
this.tag = tag;
}
@Override
public String asString() {
return compound.getString(tag);
}
@Override
public boolean asBoolean() {
return compound.getBoolean(tag);
}
@Override
public int asInt() {
return compound.getInt(tag);
}
@Override
public double asDouble() {
return compound.getDouble(tag);
}
@Override
public long asLong() {
return compound.getLong(tag);
}
@Override
public short asShort() {
return compound.getShort(tag);
}
@Override
public byte asByte() {
return compound.getByte(tag);
}
@Override
public int[] asIntArray() {
return compound.getIntArray(tag);
}

View File

@ -11,6 +11,7 @@ import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.Set;
import java.util.UUID;
public abstract class NBTCompoundImpl implements NBTCompound {
@ -96,6 +97,51 @@ public abstract class NBTCompoundImpl implements NBTCompound {
return new NBTObjectImpl(compound, tag);
}
@Override
public String getString(String tag) {
return getNBTObject(tag).asString();
}
@Override
public boolean getBoolean(String tag) {
return getNBTObject(tag).asBoolean();
}
@Override
public int getInt(String tag) {
return getNBTObject(tag).asInt();
}
@Override
public double getDouble(String tag) {
return getNBTObject(tag).asDouble();
}
@Override
public long getLong(String tag) {
return getNBTObject(tag).asLong();
}
@Override
public short getShort(String tag) {
return getNBTObject(tag).asShort();
}
@Override
public byte getByte(String tag) {
return getNBTObject(tag).asByte();
}
@Override
public int[] getIntArray(String tag) {
return getNBTObject(tag).asIntArray();
}
@Override
public Set<String> getKeys() {
return compound.c();
}
@Override
public byte[] serialize(String... exclusions) {
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

View File

@ -13,34 +13,42 @@ public class NBTObjectImpl implements NBTObject {
this.tag = tag;
}
@Override
public String asString() {
return compound.getString(tag);
}
@Override
public boolean asBoolean() {
return compound.getBoolean(tag);
}
@Override
public int asInt() {
return compound.getInt(tag);
}
@Override
public double asDouble() {
return compound.getDouble(tag);
}
@Override
public long asLong() {
return compound.getLong(tag);
}
@Override
public short asShort() {
return compound.getShort(tag);
}
@Override
public byte asByte() {
return compound.getByte(tag);
}
@Override
public int[] asIntArray() {
return compound.getIntArray(tag);
}

View File

@ -11,6 +11,7 @@ import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.Set;
import java.util.UUID;
public abstract class NBTCompoundImpl implements NBTCompound {
@ -95,6 +96,51 @@ public abstract class NBTCompoundImpl implements NBTCompound {
return new NBTObjectImpl(compound, tag);
}
@Override
public String getString(String tag) {
return getNBTObject(tag).asString();
}
@Override
public boolean getBoolean(String tag) {
return getNBTObject(tag).asBoolean();
}
@Override
public int getInt(String tag) {
return getNBTObject(tag).asInt();
}
@Override
public double getDouble(String tag) {
return getNBTObject(tag).asDouble();
}
@Override
public long getLong(String tag) {
return getNBTObject(tag).asLong();
}
@Override
public short getShort(String tag) {
return getNBTObject(tag).asShort();
}
@Override
public byte getByte(String tag) {
return getNBTObject(tag).asByte();
}
@Override
public int[] getIntArray(String tag) {
return getNBTObject(tag).asIntArray();
}
@Override
public Set<String> getKeys() {
return compound.c();
}
@Override
public byte[] serialize(String... exclusions) {
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

View File

@ -13,34 +13,42 @@ public class NBTObjectImpl implements NBTObject {
this.tag = tag;
}
@Override
public String asString() {
return compound.getString(tag);
}
@Override
public boolean asBoolean() {
return compound.getBoolean(tag);
}
@Override
public int asInt() {
return compound.getInt(tag);
}
@Override
public double asDouble() {
return compound.getDouble(tag);
}
@Override
public long asLong() {
return compound.getLong(tag);
}
@Override
public short asShort() {
return compound.getShort(tag);
}
@Override
public byte asByte() {
return compound.getByte(tag);
}
@Override
public int[] asIntArray() {
return compound.getIntArray(tag);
}

View File

@ -11,6 +11,7 @@ import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.Set;
import java.util.UUID;
public abstract class NBTCompoundImpl implements NBTCompound {
@ -95,6 +96,51 @@ public abstract class NBTCompoundImpl implements NBTCompound {
return new NBTObjectImpl(compound, tag);
}
@Override
public String getString(String tag) {
return getNBTObject(tag).asString();
}
@Override
public boolean getBoolean(String tag) {
return getNBTObject(tag).asBoolean();
}
@Override
public int getInt(String tag) {
return getNBTObject(tag).asInt();
}
@Override
public double getDouble(String tag) {
return getNBTObject(tag).asDouble();
}
@Override
public long getLong(String tag) {
return getNBTObject(tag).asLong();
}
@Override
public short getShort(String tag) {
return getNBTObject(tag).asShort();
}
@Override
public byte getByte(String tag) {
return getNBTObject(tag).asByte();
}
@Override
public int[] getIntArray(String tag) {
return getNBTObject(tag).asIntArray();
}
@Override
public Set<String> getKeys() {
return compound.c();
}
@Override
public byte[] serialize(String... exclusions) {
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

View File

@ -13,34 +13,42 @@ public class NBTObjectImpl implements NBTObject {
this.tag = tag;
}
@Override
public String asString() {
return compound.getString(tag);
}
@Override
public boolean asBoolean() {
return compound.getBoolean(tag);
}
@Override
public int asInt() {
return compound.getInt(tag);
}
@Override
public double asDouble() {
return compound.getDouble(tag);
}
@Override
public long asLong() {
return compound.getLong(tag);
}
@Override
public short asShort() {
return compound.getShort(tag);
}
@Override
public byte asByte() {
return compound.getByte(tag);
}
@Override
public int[] asIntArray() {
return compound.getIntArray(tag);
}