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

View File

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

View File

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