Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5360474
commit f7e48b2
Showing
20 changed files
with
1,192 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
nmsutils-core/src/main/java/de/cubeside/nmsutils/nbt/ByteArrayTag.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package de.cubeside.nmsutils.nbt; | ||
|
||
import com.google.common.base.Preconditions; | ||
import java.util.Arrays; | ||
|
||
public final class ByteArrayTag extends Tag { | ||
private byte[] value; | ||
|
||
public ByteArrayTag(byte[] value) { | ||
Preconditions.checkNotNull(value); | ||
this.value = value; | ||
} | ||
|
||
public byte[] getValue() { | ||
return value; | ||
} | ||
|
||
public void setValue(byte[] value) { | ||
Preconditions.checkNotNull(value); | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public TagType getType() { | ||
return TagType.BYTE_ARRAY; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Arrays.hashCode(this.value); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
return obj instanceof ByteArrayTag o && Arrays.equals(value, o.value); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
nmsutils-core/src/main/java/de/cubeside/nmsutils/nbt/ByteTag.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package de.cubeside.nmsutils.nbt; | ||
|
||
public final class ByteTag extends Tag implements NumericTag { | ||
private byte value; | ||
|
||
public ByteTag(byte value) { | ||
this.value = value; | ||
} | ||
|
||
public byte getValue() { | ||
return value; | ||
} | ||
|
||
public void setValue(byte value) { | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public int getValueAsInt() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public long getValueAsLong() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public double getValueAsDouble() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public TagType getType() { | ||
return TagType.BYTE; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return this.value; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
return obj instanceof ByteTag o && value == o.value; | ||
} | ||
} |
Oops, something went wrong.