Start to add other data types
This commit is contained in:
parent
cdc9b92d2d
commit
e621cb9468
3 changed files with 72 additions and 9 deletions
36
src/main/java/dev/zontreck/registry/VInt32.java
Normal file
36
src/main/java/dev/zontreck/registry/VInt32.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
package dev.zontreck.registry;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class VInt32 extends Entry {
|
||||
public VInt32(String name, int value) {
|
||||
super(EntryType.Int32, name);
|
||||
Parent = null;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public int Value;
|
||||
|
||||
@Override
|
||||
public void readValue(DataInputStream stream) throws IOException {
|
||||
Value = stream.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Write(DataOutputStream stream) throws IOException {
|
||||
super.Write(stream);
|
||||
stream.writeInt(Value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String PrettyPrint(int indent) {
|
||||
return super.PrettyPrint(indent) + " [" + Value + "]";
|
||||
}
|
||||
|
||||
public VInt32 setInt32(int value) {
|
||||
Value = value;
|
||||
return this;
|
||||
}
|
||||
}
|
36
src/main/java/dev/zontreck/registry/VInt64.java
Normal file
36
src/main/java/dev/zontreck/registry/VInt64.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
package dev.zontreck.registry;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class VInt64 extends Entry {
|
||||
public VInt64(String name, long value) {
|
||||
super(EntryType.Int64, name);
|
||||
Parent = null;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public long Value;
|
||||
|
||||
@Override
|
||||
public void readValue(DataInputStream stream) throws IOException {
|
||||
Value = stream.readLong();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Write(DataOutputStream stream) throws IOException {
|
||||
super.Write(stream);
|
||||
stream.writeLong(Value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String PrettyPrint(int indent) {
|
||||
return super.PrettyPrint(indent) + " [" + Value + "]";
|
||||
}
|
||||
|
||||
public VInt64 setInt64(long value) {
|
||||
Value = value;
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -29,15 +29,6 @@ public class Word extends Entry {
|
|||
return super.PrettyPrint(indent) + " [" + Value + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Object value) {
|
||||
super.setValue(value);
|
||||
|
||||
if (value instanceof String str) {
|
||||
Value = str;
|
||||
}
|
||||
}
|
||||
|
||||
public Word setWord(String value) {
|
||||
Value = value;
|
||||
return this;
|
||||
|
|
Loading…
Reference in a new issue