Update stuff, but get rid of NBT
This commit is contained in:
parent
addbaf340b
commit
55dcf92fe7
23 changed files with 121 additions and 25 deletions
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
9
src/main/java/dev/zontreck/ariaslib/nbt/current/Tag.java
Normal file
9
src/main/java/dev/zontreck/ariaslib/nbt/current/Tag.java
Normal 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;
|
||||
}
|
51
src/main/java/dev/zontreck/ariaslib/nbt/current/TagType.java
Normal file
51
src/main/java/dev/zontreck/ariaslib/nbt/current/TagType.java
Normal 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;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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
|
|
@ -1,4 +1,4 @@
|
|||
package dev.zontreck.ariaslib.nbt;
|
||||
package dev.zontreck.ariaslib.nbt.old;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
|
@ -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;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package dev.zontreck.ariaslib.nbt;
|
||||
package dev.zontreck.ariaslib.nbt.old;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
|
@ -1,4 +1,4 @@
|
|||
package dev.zontreck.ariaslib.nbt;
|
||||
package dev.zontreck.ariaslib.nbt.old;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
|
@ -1,4 +1,4 @@
|
|||
package dev.zontreck.ariaslib.nbt;
|
||||
package dev.zontreck.ariaslib.nbt.old;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
|
@ -1,4 +1,4 @@
|
|||
package dev.zontreck.ariaslib.nbt;
|
||||
package dev.zontreck.ariaslib.nbt.old;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
|
@ -1,4 +1,4 @@
|
|||
package dev.zontreck.ariaslib.nbt;
|
||||
package dev.zontreck.ariaslib.nbt.old;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
|
@ -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
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
package dev.zontreck.ariaslib.nbt;
|
||||
package dev.zontreck.ariaslib.nbt.old;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
|
@ -1,4 +1,4 @@
|
|||
package dev.zontreck.ariaslib.nbt;
|
||||
package dev.zontreck.ariaslib.nbt.old;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
|
@ -1,4 +1,4 @@
|
|||
package dev.zontreck.ariaslib.nbt;
|
||||
package dev.zontreck.ariaslib.nbt.old;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
|
@ -1,4 +1,4 @@
|
|||
package dev.zontreck.ariaslib.nbt;
|
||||
package dev.zontreck.ariaslib.nbt.old;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
|
@ -1,4 +1,4 @@
|
|||
package dev.zontreck.ariaslib.nbt;
|
||||
package dev.zontreck.ariaslib.nbt.old;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
|
@ -1,4 +1,4 @@
|
|||
package dev.zontreck.ariaslib.nbt;
|
||||
package dev.zontreck.ariaslib.nbt.old;
|
||||
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
|
@ -1,4 +1,4 @@
|
|||
package dev.zontreck.ariaslib.nbt;
|
||||
package dev.zontreck.ariaslib.nbt.old;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.IOException;
|
|
@ -1,4 +1,4 @@
|
|||
package dev.zontreck.ariaslib.nbt;
|
||||
package dev.zontreck.ariaslib.nbt.old;
|
||||
|
||||
public enum TagTypes {
|
||||
End(EndTag.TYPE), // 0
|
Loading…
Reference in a new issue