mirror of
https://github.com/ViaVersion/ViaNBT.git
synced 2024-09-30 04:17:34 +02:00
Remove unnecessary resource inclusion, use getUnsigned methods for tag IDs and name lengths
This commit is contained in:
parent
f7319079e5
commit
3df755b8da
8
pom.xml
8
pom.xml
@ -52,14 +52,6 @@
|
|||||||
<build>
|
<build>
|
||||||
<defaultGoal>clean install</defaultGoal>
|
<defaultGoal>clean install</defaultGoal>
|
||||||
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
|
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
|
||||||
<!-- Resources -->
|
|
||||||
<resources>
|
|
||||||
<resource>
|
|
||||||
<targetPath>.</targetPath>
|
|
||||||
<filtering>true</filtering>
|
|
||||||
<directory>${basedir}/src/main/resources</directory>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
@ -47,12 +47,12 @@ public class NBTIO {
|
|||||||
* @throws java.io.IOException If an I/O error occurs.
|
* @throws java.io.IOException If an I/O error occurs.
|
||||||
*/
|
*/
|
||||||
public static Tag readTag(DataInputStream in) throws IOException {
|
public static Tag readTag(DataInputStream in) throws IOException {
|
||||||
int id = in.readByte() & 0xFF;
|
int id = in.readUnsignedByte();
|
||||||
if(id == 0) {
|
if(id == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] nameBytes = new byte[in.readShort() & 0xFFFF];
|
byte[] nameBytes = new byte[in.readUnsignedShort()];
|
||||||
in.readFully(nameBytes);
|
in.readFully(nameBytes);
|
||||||
String name = new String(nameBytes, CHARSET);
|
String name = new String(nameBytes, CHARSET);
|
||||||
Tag tag = null;
|
Tag tag = null;
|
||||||
|
@ -120,7 +120,7 @@ public class ListTag<T extends Tag> extends Tag implements Iterable<T> {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void read(DataInputStream in) throws IOException {
|
public void read(DataInputStream in) throws IOException {
|
||||||
int id = in.readByte() & 0xFF;
|
int id = in.readUnsignedByte();
|
||||||
this.type = (Class<T>) TagRegistry.getClassFor(id);
|
this.type = (Class<T>) TagRegistry.getClassFor(id);
|
||||||
this.value = new ArrayList<T>();
|
this.value = new ArrayList<T>();
|
||||||
if(this.type == null) {
|
if(this.type == null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user