--- a/net/minecraft/nbt/NbtIo.java +++ b/net/minecraft/nbt/NbtIo.java @@ -1,3 +1,4 @@ +// mc-dev import package net.minecraft.nbt; import java.io.BufferedOutputStream; @@ -29,13 +30,13 @@ public NbtIo() {} - public static CompoundTag readCompressed(Path path, NbtAccounter nbtaccounter) throws IOException { + public static CompoundTag readCompressed(Path path, NbtAccounter nbtreadlimiter) throws IOException { InputStream inputstream = Files.newInputStream(path); - CompoundTag compoundtag; + CompoundTag nbttagcompound; try { - compoundtag = readCompressed(inputstream, nbtaccounter); + nbttagcompound = readCompressed(inputstream, nbtreadlimiter); } catch (Throwable throwable) { if (inputstream != null) { try { @@ -52,24 +53,24 @@ inputstream.close(); } - return compoundtag; + return nbttagcompound; } - private static DataInputStream createDecompressorStream(InputStream inputstream) throws IOException { - return new DataInputStream(new FastBufferedInputStream(new GZIPInputStream(inputstream))); + private static DataInputStream createDecompressorStream(InputStream zippedStream) throws IOException { + return new DataInputStream(new FastBufferedInputStream(new GZIPInputStream(zippedStream))); } private static DataOutputStream createCompressorStream(OutputStream outputstream) throws IOException { return new DataOutputStream(new BufferedOutputStream(new GZIPOutputStream(outputstream))); } - public static CompoundTag readCompressed(InputStream inputstream, NbtAccounter nbtaccounter) throws IOException { + public static CompoundTag readCompressed(InputStream inputstream, NbtAccounter nbtreadlimiter) throws IOException { DataInputStream datainputstream = createDecompressorStream(inputstream); - CompoundTag compoundtag; + CompoundTag nbttagcompound; try { - compoundtag = read(datainputstream, nbtaccounter); + nbttagcompound = read(datainputstream, nbtreadlimiter); } catch (Throwable throwable) { if (datainputstream != null) { try { @@ -86,14 +87,14 @@ datainputstream.close(); } - return compoundtag; + return nbttagcompound; } - public static void parseCompressed(Path path, StreamTagVisitor streamtagvisitor, NbtAccounter nbtaccounter) throws IOException { + public static void parseCompressed(Path path, StreamTagVisitor streamtagvisitor, NbtAccounter nbtreadlimiter) throws IOException { InputStream inputstream = Files.newInputStream(path); try { - parseCompressed(inputstream, streamtagvisitor, nbtaccounter); + parseCompressed(inputstream, streamtagvisitor, nbtreadlimiter); } catch (Throwable throwable) { if (inputstream != null) { try { @@ -112,11 +113,11 @@ } - public static void parseCompressed(InputStream inputstream, StreamTagVisitor streamtagvisitor, NbtAccounter nbtaccounter) throws IOException { + public static void parseCompressed(InputStream inputstream, StreamTagVisitor streamtagvisitor, NbtAccounter nbtreadlimiter) throws IOException { DataInputStream datainputstream = createDecompressorStream(inputstream); try { - parse(datainputstream, streamtagvisitor, nbtaccounter); + parse(datainputstream, streamtagvisitor, nbtreadlimiter); } catch (Throwable throwable) { if (datainputstream != null) { try { @@ -135,14 +136,14 @@ } - public static void writeCompressed(CompoundTag compoundtag, Path path) throws IOException { + public static void writeCompressed(CompoundTag nbttagcompound, Path path) throws IOException { OutputStream outputstream = Files.newOutputStream(path, NbtIo.SYNC_OUTPUT_OPTIONS); try { BufferedOutputStream bufferedoutputstream = new BufferedOutputStream(outputstream); try { - writeCompressed(compoundtag, (OutputStream) bufferedoutputstream); + writeCompressed(nbttagcompound, (OutputStream) bufferedoutputstream); } catch (Throwable throwable) { try { bufferedoutputstream.close(); @@ -172,11 +173,11 @@ } - public static void writeCompressed(CompoundTag compoundtag, OutputStream outputstream) throws IOException { - DataOutputStream dataoutputstream = createCompressorStream(outputstream); + public static void writeCompressed(CompoundTag compoundTag, OutputStream outputStream) throws IOException { + DataOutputStream dataoutputstream = createCompressorStream(outputStream); try { - write(compoundtag, (DataOutput) dataoutputstream); + write(compoundTag, (DataOutput) dataoutputstream); } catch (Throwable throwable) { if (dataoutputstream != null) { try { @@ -195,7 +196,7 @@ } - public static void write(CompoundTag compoundtag, Path path) throws IOException { + public static void write(CompoundTag nbttagcompound, Path path) throws IOException { OutputStream outputstream = Files.newOutputStream(path, NbtIo.SYNC_OUTPUT_OPTIONS); try { @@ -205,7 +206,7 @@ DataOutputStream dataoutputstream = new DataOutputStream(bufferedoutputstream); try { - write(compoundtag, (DataOutput) dataoutputstream); + write(nbttagcompound, (DataOutput) dataoutputstream); } catch (Throwable throwable) { try { dataoutputstream.close(); @@ -253,13 +254,13 @@ } else { InputStream inputstream = Files.newInputStream(path); - CompoundTag compoundtag; + CompoundTag nbttagcompound; try { DataInputStream datainputstream = new DataInputStream(inputstream); try { - compoundtag = read(datainputstream, NbtAccounter.unlimitedHeap()); + nbttagcompound = read(datainputstream, NbtAccounter.unlimitedHeap()); } catch (Throwable throwable) { try { datainputstream.close(); @@ -287,109 +288,108 @@ inputstream.close(); } - return compoundtag; + return nbttagcompound; } } - public static CompoundTag read(DataInput datainput) throws IOException { - return read(datainput, NbtAccounter.unlimitedHeap()); + public static CompoundTag read(DataInput input) throws IOException { + return read(input, NbtAccounter.unlimitedHeap()); } - public static CompoundTag read(DataInput datainput, NbtAccounter nbtaccounter) throws IOException { - Tag tag = readUnnamedTag(datainput, nbtaccounter); + public static CompoundTag read(DataInput input, NbtAccounter accounter) throws IOException { + Tag nbtbase = readUnnamedTag(input, accounter); - if (tag instanceof CompoundTag) { - return (CompoundTag) tag; + if (nbtbase instanceof CompoundTag) { + return (CompoundTag) nbtbase; } else { throw new IOException("Root tag must be a named compound tag"); } } - public static void write(CompoundTag compoundtag, DataOutput dataoutput) throws IOException { - writeUnnamedTagWithFallback(compoundtag, dataoutput); + public static void write(CompoundTag compoundTag, DataOutput output) throws IOException { + writeUnnamedTagWithFallback(compoundTag, output); } - public static void parse(DataInput datainput, StreamTagVisitor streamtagvisitor, NbtAccounter nbtaccounter) throws IOException { - TagType tagtype = TagTypes.getType(datainput.readByte()); + public static void parse(DataInput datainput, StreamTagVisitor streamtagvisitor, NbtAccounter nbtreadlimiter) throws IOException { + TagType nbttagtype = TagTypes.getType(datainput.readByte()); - if (tagtype == EndTag.TYPE) { - if (streamtagvisitor.visitRootEntry(EndTag.TYPE) == StreamTagVisitor.ValueResult.CONTINUE) { + if (nbttagtype == EndTag.TYPE) { + if (streamtagvisitor.visitRootEntry(EndTag.TYPE) == StreamTagVisitor.b.CONTINUE) { streamtagvisitor.visitEnd(); } } else { - switch (streamtagvisitor.visitRootEntry(tagtype)) { + switch (streamtagvisitor.visitRootEntry(nbttagtype)) { case HALT: default: break; case BREAK: StringTag.skipString(datainput); - tagtype.skip(datainput, nbtaccounter); + nbttagtype.skip(datainput, nbtreadlimiter); break; case CONTINUE: StringTag.skipString(datainput); - tagtype.parse(datainput, streamtagvisitor, nbtaccounter); + nbttagtype.parse(datainput, streamtagvisitor, nbtreadlimiter); } } } - public static Tag readAnyTag(DataInput datainput, NbtAccounter nbtaccounter) throws IOException { + public static Tag readAnyTag(DataInput datainput, NbtAccounter nbtreadlimiter) throws IOException { byte b0 = datainput.readByte(); - return (Tag) (b0 == 0 ? EndTag.INSTANCE : readTagSafe(datainput, nbtaccounter, b0)); + return (Tag) (b0 == 0 ? EndTag.INSTANCE : readTagSafe(datainput, nbtreadlimiter, b0)); } - public static void writeAnyTag(Tag tag, DataOutput dataoutput) throws IOException { - dataoutput.writeByte(tag.getId()); - if (tag.getId() != 0) { - tag.write(dataoutput); + public static void writeAnyTag(Tag nbtbase, DataOutput dataoutput) throws IOException { + dataoutput.writeByte(nbtbase.getId()); + if (nbtbase.getId() != 0) { + nbtbase.write(dataoutput); } } - public static void writeUnnamedTag(Tag tag, DataOutput dataoutput) throws IOException { - dataoutput.writeByte(tag.getId()); + public static void writeUnnamedTag(Tag tag, DataOutput output) throws IOException { + output.writeByte(tag.getId()); if (tag.getId() != 0) { - dataoutput.writeUTF(""); - tag.write(dataoutput); + output.writeUTF(""); + tag.write(output); } } - public static void writeUnnamedTagWithFallback(Tag tag, DataOutput dataoutput) throws IOException { - writeUnnamedTag(tag, new NbtIo.StringFallbackDataOutput(dataoutput)); + public static void writeUnnamedTagWithFallback(Tag nbtbase, DataOutput dataoutput) throws IOException { + writeUnnamedTag(nbtbase, new NbtIo.a(dataoutput)); } - private static Tag readUnnamedTag(DataInput datainput, NbtAccounter nbtaccounter) throws IOException { + private static Tag readUnnamedTag(DataInput datainput, NbtAccounter nbtreadlimiter) throws IOException { byte b0 = datainput.readByte(); if (b0 == 0) { return EndTag.INSTANCE; } else { StringTag.skipString(datainput); - return readTagSafe(datainput, nbtaccounter, b0); + return readTagSafe(datainput, nbtreadlimiter, b0); } } - private static Tag readTagSafe(DataInput datainput, NbtAccounter nbtaccounter, byte b0) { + private static Tag readTagSafe(DataInput datainput, NbtAccounter nbtreadlimiter, byte b0) { try { - return TagTypes.getType(b0).load(datainput, nbtaccounter); + return TagTypes.getType(b0).load(datainput, nbtreadlimiter); } catch (IOException ioexception) { CrashReport crashreport = CrashReport.forThrowable(ioexception, "Loading NBT data"); - CrashReportCategory crashreportcategory = crashreport.addCategory("NBT Tag"); + CrashReportCategory crashreportsystemdetails = crashreport.addCategory("NBT Tag"); - crashreportcategory.setDetail("Tag type", (Object) b0); + crashreportsystemdetails.setDetail("Tag type", (Object) b0); throw new ReportedNbtException(crashreport); } } - public static class StringFallbackDataOutput extends DelegateDataOutput { + public static class a extends DelegateDataOutput { - public StringFallbackDataOutput(DataOutput dataoutput) { + public a(DataOutput dataoutput) { super(dataoutput); } @Override - @Override public void writeUTF(String s) throws IOException { try { super.writeUTF(s);