mirror of
https://github.com/ViaVersion/ViaNBT.git
synced 2024-11-14 10:15:40 +01: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>
|
||||
<defaultGoal>clean install</defaultGoal>
|
||||
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
|
||||
<!-- Resources -->
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}/src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@ -47,12 +47,12 @@ public class NBTIO {
|
||||
* @throws java.io.IOException If an I/O error occurs.
|
||||
*/
|
||||
public static Tag readTag(DataInputStream in) throws IOException {
|
||||
int id = in.readByte() & 0xFF;
|
||||
int id = in.readUnsignedByte();
|
||||
if(id == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
byte[] nameBytes = new byte[in.readShort() & 0xFFFF];
|
||||
byte[] nameBytes = new byte[in.readUnsignedShort()];
|
||||
in.readFully(nameBytes);
|
||||
String name = new String(nameBytes, CHARSET);
|
||||
Tag tag = null;
|
||||
|
@ -120,7 +120,7 @@ public class ListTag<T extends Tag> extends Tag implements Iterable<T> {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void read(DataInputStream in) throws IOException {
|
||||
int id = in.readByte() & 0xFF;
|
||||
int id = in.readUnsignedByte();
|
||||
this.type = (Class<T>) TagRegistry.getClassFor(id);
|
||||
this.value = new ArrayList<T>();
|
||||
if(this.type == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user