Update stuff, but get rid of NBT

This commit is contained in:
Aria 2023-03-15 17:51:54 -07:00
parent addbaf340b
commit 55dcf92fe7
23 changed files with 121 additions and 25 deletions

View file

@ -1,8 +1,6 @@
package dev.zontreck.ariaslib.events;
import java.io.File;
import dev.zontreck.ariaslib.nbt.CompoundTag;
import dev.zontreck.ariaslib.nbt.old.CompoundTag;
/**
* This event cannot be cancelled.

View file

@ -1,6 +1,6 @@
package dev.zontreck.ariaslib.events;
import dev.zontreck.ariaslib.nbt.CompoundTag;
import dev.zontreck.ariaslib.nbt.old.CompoundTag;
/**
* This event is cancellable. Cancelling this event will result in the saving process being interrupted, and the tag to be saved, replaced right before saving completes

View file

@ -0,0 +1,9 @@
package dev.zontreck.ariaslib.nbt.current;
public abstract class Tag implements Cloneable, Comparable<Tag>
{
public Tag parent;
public abstract TagType Type;
public boolean hasValue;
}

View file

@ -0,0 +1,51 @@
package dev.zontreck.ariaslib.nbt.current;
import dev.zontreck.ariaslib.nbt.old.EndTag;
import dev.zontreck.ariaslib.nbt.old.Tag;
import java.io.DataInput;
import java.io.IOException;
public interface TagType<T extends Tag>
{
T load(DataInput input) throws IOException;
void skip(DataInput input) throws IOException;
boolean hasValue();
String getName();
String getPrettyName();
static TagType<EndTag> invalid(int num)
{
return new TagType<EndTag>() {
@Override
public EndTag load(DataInput input) throws IOException {
throw new IOException("Invalid operation, this tag is invalid");
}
@Override
public void skip(DataInput input) throws IOException {
}
@Override
public String getName() {
return "INVALID";
}
@Override
public String getPrettyName() {
return "TAG_INVALID";
}
@Override
public boolean hasValue() {
return false;
}
};
}
}

View file

@ -0,0 +1,42 @@
package dev.zontreck.ariaslib.nbt.current;
import dev.zontreck.ariaslib.nbt.old.TagType;
import dev.zontreck.ariaslib.nbt.old.*;
public enum TagTypes {
End(EndTag.TYPE), // 0
Byte(ByteTag.TYPE), // 1
Short(ShortTag.TYPE), // 2
Int(IntTag.TYPE), // 3
Long(LongTag.TYPE), // 4
Float(FloatTag.TYPE), // 5
Double(DoubleTag.TYPE), // 6
ByteArray(ByteArrayTag.TYPE), // 7
String(StringTag.TYPE), // 8
List(ListTag.TYPE), // 9
Compound(CompoundTag.TYPE), // 10
IntArray(IntArrayTag.TYPE), // 11
LongArray(LongArrayTag.TYPE); // 12
//public static final TagType<?>[] TYPES = new TagType[]{EndTag.TYPE, ByteTag.TYPE};
public dev.zontreck.ariaslib.nbt.old.TagType<?> type;
/**
* Locates the type in this enum
* @param value
* @return A TagType for the requested value
*/
public static dev.zontreck.ariaslib.nbt.old.TagType<?> getType(int value)
{
if(value>values().length)
{
return End.type;
}else {
return values()[value].type;
}
}
TagTypes(TagType<?> type)
{
this.type=type;
}
}

View file

@ -1,10 +1,9 @@
package dev.zontreck.ariaslib.nbt;
package dev.zontreck.ariaslib.nbt.old;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class ByteArrayTag implements Tag

View file

@ -1,4 +1,4 @@
package dev.zontreck.ariaslib.nbt;
package dev.zontreck.ariaslib.nbt.old;
import java.io.DataInput;
import java.io.DataOutput;

View file

@ -1,12 +1,10 @@
package dev.zontreck.ariaslib.nbt;
package dev.zontreck.ariaslib.nbt.old;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

View file

@ -1,4 +1,4 @@
package dev.zontreck.ariaslib.nbt;
package dev.zontreck.ariaslib.nbt.old;
import java.io.DataInput;
import java.io.DataOutput;

View file

@ -1,4 +1,4 @@
package dev.zontreck.ariaslib.nbt;
package dev.zontreck.ariaslib.nbt.old;
import java.io.DataInput;
import java.io.DataOutput;

View file

@ -1,4 +1,4 @@
package dev.zontreck.ariaslib.nbt;
package dev.zontreck.ariaslib.nbt.old;
import java.io.DataInput;
import java.io.DataOutput;

View file

@ -1,4 +1,4 @@
package dev.zontreck.ariaslib.nbt;
package dev.zontreck.ariaslib.nbt.old;
import java.io.DataInput;
import java.io.DataOutput;

View file

@ -1,4 +1,4 @@
package dev.zontreck.ariaslib.nbt;
package dev.zontreck.ariaslib.nbt.old;
import java.io.DataInput;
import java.io.DataOutput;

View file

@ -1,4 +1,4 @@
package dev.zontreck.ariaslib.nbt;
package dev.zontreck.ariaslib.nbt.old;
import java.io.DataInput;
import java.io.DataOutput;
@ -7,7 +7,6 @@ import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
public class ListTag implements Tag
{

View file

@ -1,4 +1,4 @@
package dev.zontreck.ariaslib.nbt;
package dev.zontreck.ariaslib.nbt.old;
import java.io.DataInput;
import java.io.DataOutput;

View file

@ -1,4 +1,4 @@
package dev.zontreck.ariaslib.nbt;
package dev.zontreck.ariaslib.nbt.old;
import java.io.DataInput;
import java.io.DataOutput;

View file

@ -1,4 +1,4 @@
package dev.zontreck.ariaslib.nbt;
package dev.zontreck.ariaslib.nbt.old;
import java.io.DataInputStream;
import java.io.DataOutputStream;

View file

@ -1,4 +1,4 @@
package dev.zontreck.ariaslib.nbt;
package dev.zontreck.ariaslib.nbt.old;
import java.io.DataInput;
import java.io.DataOutput;

View file

@ -1,4 +1,4 @@
package dev.zontreck.ariaslib.nbt;
package dev.zontreck.ariaslib.nbt.old;
import java.io.DataInput;
import java.io.DataOutput;

View file

@ -1,4 +1,4 @@
package dev.zontreck.ariaslib.nbt;
package dev.zontreck.ariaslib.nbt.old;
import java.io.DataOutput;
import java.io.IOException;

View file

@ -1,4 +1,4 @@
package dev.zontreck.ariaslib.nbt;
package dev.zontreck.ariaslib.nbt.old;
import java.io.DataInput;
import java.io.IOException;

View file

@ -1,4 +1,4 @@
package dev.zontreck.ariaslib.nbt;
package dev.zontreck.ariaslib.nbt.old;
public enum TagTypes {
End(EndTag.TYPE), // 0