Remove unnecessary resource inclusion, use getUnsigned methods for tag IDs and name lengths

This commit is contained in:
Steveice10 2014-03-21 23:26:39 -07:00
parent f7319079e5
commit 3df755b8da
3 changed files with 3 additions and 11 deletions

View File

@ -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>

View File

@ -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;

View File

@ -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) {