forked from cybertiger/Bukkit-LibNBT
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for long arrays in 1.15 & 1.16
- Loading branch information
1 parent
d619b57
commit 1449acc
Showing
4 changed files
with
129 additions
and
3 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
libnbt-standalone/src/main/java/org/cyberiantiger/minecraft/nbt/LongArrayTag.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,67 @@ | ||
/* | ||
* To change this template, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
|
||
package org.cyberiantiger.minecraft.nbt; | ||
|
||
import java.util.Arrays; | ||
|
||
/** | ||
* | ||
* @author antony | ||
*/ | ||
public final class LongArrayTag extends Tag<long[]> { | ||
private final long[] value; | ||
public LongArrayTag(long[] value) { | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public long[] getValue() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public TagType getType() { | ||
return TagType.LONG_ARRAY; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder ret = new StringBuilder(); | ||
ret.append('«'); | ||
long[] v = getValue(); | ||
for (int i = 0; i < v.length; i++) { | ||
if (i != 0) { | ||
ret.append(", "); | ||
} | ||
ret.append(v[i]); | ||
} | ||
ret.append('»'); | ||
return ret.toString(); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int hash = 5; | ||
hash = 23 * hash + Arrays.hashCode(this.value); | ||
return hash; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (obj == null) { | ||
return false; | ||
} | ||
if (getClass() != obj.getClass()) { | ||
return false; | ||
} | ||
final LongArrayTag other = (LongArrayTag) obj; | ||
if (!Arrays.equals(this.value, other.value)) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
} |
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
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
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