mirror of
https://github.com/Eaglercraft-Archive/EaglercraftX-1.8-workspace.git
synced 2026-07-17 17:21:11 +02:00
u37
This commit is contained in:
+129
@@ -0,0 +1,129 @@
|
||||
package net.minecraft.nbt;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.DataInput;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutput;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EaglerZLIB;
|
||||
import net.minecraft.crash.CrashReport;
|
||||
import net.minecraft.crash.CrashReportCategory;
|
||||
import net.minecraft.util.ReportedException;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class CompressedStreamTools {
|
||||
/**+
|
||||
* Load the gzipped compound from the inputstream.
|
||||
*/
|
||||
public static NBTTagCompound readCompressed(InputStream is) throws IOException {
|
||||
DataInputStream datainputstream = new DataInputStream(
|
||||
new BufferedInputStream(EaglerZLIB.newGZIPInputStream(is)));
|
||||
|
||||
NBTTagCompound nbttagcompound;
|
||||
try {
|
||||
nbttagcompound = read(datainputstream, NBTSizeTracker.INFINITE);
|
||||
} finally {
|
||||
datainputstream.close();
|
||||
}
|
||||
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Write the compound, gzipped, to the outputstream.
|
||||
*/
|
||||
public static void writeCompressed(NBTTagCompound outputStream, OutputStream parOutputStream) throws IOException {
|
||||
DataOutputStream dataoutputstream = new DataOutputStream(
|
||||
new BufferedOutputStream(EaglerZLIB.newGZIPOutputStream(parOutputStream)));
|
||||
|
||||
try {
|
||||
write(outputStream, (DataOutput) dataoutputstream);
|
||||
} finally {
|
||||
dataoutputstream.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**+
|
||||
* Reads the given DataInput, constructs, and returns an
|
||||
* NBTTagCompound with the data from the DataInput
|
||||
*/
|
||||
public static NBTTagCompound read(DataInputStream inputStream) throws IOException {
|
||||
/**+
|
||||
* Reads the given DataInput, constructs, and returns an
|
||||
* NBTTagCompound with the data from the DataInput
|
||||
*/
|
||||
return read(inputStream, NBTSizeTracker.INFINITE);
|
||||
}
|
||||
|
||||
/**+
|
||||
* Reads the given DataInput, constructs, and returns an
|
||||
* NBTTagCompound with the data from the DataInput
|
||||
*/
|
||||
public static NBTTagCompound read(DataInput parDataInput, NBTSizeTracker parNBTSizeTracker) throws IOException {
|
||||
NBTBase nbtbase = func_152455_a(parDataInput, 0, parNBTSizeTracker);
|
||||
if (nbtbase instanceof NBTTagCompound) {
|
||||
return (NBTTagCompound) nbtbase;
|
||||
} else {
|
||||
throw new IOException("Root tag must be a named compound tag");
|
||||
}
|
||||
}
|
||||
|
||||
public static void write(NBTTagCompound parNBTTagCompound, DataOutput parDataOutput) throws IOException {
|
||||
writeTag(parNBTTagCompound, parDataOutput);
|
||||
}
|
||||
|
||||
private static void writeTag(NBTBase parNBTBase, DataOutput parDataOutput) throws IOException {
|
||||
parDataOutput.writeByte(parNBTBase.getId());
|
||||
if (parNBTBase.getId() != 0) {
|
||||
parDataOutput.writeUTF("");
|
||||
parNBTBase.write(parDataOutput);
|
||||
}
|
||||
}
|
||||
|
||||
private static NBTBase func_152455_a(DataInput parDataInput, int parInt1, NBTSizeTracker parNBTSizeTracker)
|
||||
throws IOException {
|
||||
byte b0 = parDataInput.readByte();
|
||||
if (b0 == 0) {
|
||||
return new NBTTagEnd();
|
||||
} else {
|
||||
parDataInput.readUTF();
|
||||
NBTBase nbtbase = NBTBase.createNewByType(b0);
|
||||
|
||||
try {
|
||||
nbtbase.read(parDataInput, parInt1, parNBTSizeTracker);
|
||||
return nbtbase;
|
||||
} catch (IOException ioexception) {
|
||||
CrashReport crashreport = CrashReport.makeCrashReport(ioexception, "Loading NBT data");
|
||||
CrashReportCategory crashreportcategory = crashreport.makeCategory("NBT Tag");
|
||||
crashreportcategory.addCrashSection("Tag name", "[UNNAMED TAG]");
|
||||
crashreportcategory.addCrashSection("Tag type", Byte.valueOf(b0));
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+434
@@ -0,0 +1,434 @@
|
||||
package net.minecraft.nbt;
|
||||
|
||||
import java.util.Stack;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class JsonToNBT {
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
private static final Pattern field_179273_b = Pattern.compile("\\[[-+\\d|,\\s]+\\]");
|
||||
|
||||
public static NBTTagCompound getTagFromJson(String jsonString) throws NBTException {
|
||||
jsonString = jsonString.trim();
|
||||
if (!jsonString.startsWith("{")) {
|
||||
throw new NBTException("Invalid tag encountered, expected \'{\' as first char.");
|
||||
} else if (func_150310_b(jsonString) != 1) {
|
||||
throw new NBTException("Encountered multiple top tags, only one expected");
|
||||
} else {
|
||||
return (NBTTagCompound) func_150316_a("tag", jsonString).parse();
|
||||
}
|
||||
}
|
||||
|
||||
static int func_150310_b(String parString1) throws NBTException {
|
||||
int i = 0;
|
||||
boolean flag = false;
|
||||
Stack stack = new Stack();
|
||||
|
||||
for (int j = 0; j < parString1.length(); ++j) {
|
||||
char c0 = parString1.charAt(j);
|
||||
if (c0 == 34) {
|
||||
if (func_179271_b(parString1, j)) {
|
||||
if (!flag) {
|
||||
throw new NBTException("Illegal use of \\\": " + parString1);
|
||||
}
|
||||
} else {
|
||||
flag = !flag;
|
||||
}
|
||||
} else if (!flag) {
|
||||
if (c0 != 123 && c0 != 91) {
|
||||
if (c0 == 125 && (stack.isEmpty() || ((Character) stack.pop()).charValue() != 123)) {
|
||||
throw new NBTException("Unbalanced curly brackets {}: " + parString1);
|
||||
}
|
||||
|
||||
if (c0 == 93 && (stack.isEmpty() || ((Character) stack.pop()).charValue() != 91)) {
|
||||
throw new NBTException("Unbalanced square brackets []: " + parString1);
|
||||
}
|
||||
} else {
|
||||
if (stack.isEmpty()) {
|
||||
++i;
|
||||
}
|
||||
|
||||
stack.push(Character.valueOf(c0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
throw new NBTException("Unbalanced quotation: " + parString1);
|
||||
} else if (!stack.isEmpty()) {
|
||||
throw new NBTException("Unbalanced brackets: " + parString1);
|
||||
} else {
|
||||
if (i == 0 && !parString1.isEmpty()) {
|
||||
i = 1;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
static JsonToNBT.Any func_179272_a(String... parArrayOfString) throws NBTException {
|
||||
return func_150316_a(parArrayOfString[0], parArrayOfString[1]);
|
||||
}
|
||||
|
||||
static JsonToNBT.Any func_150316_a(String parString1, String parString2) throws NBTException {
|
||||
parString2 = parString2.trim();
|
||||
if (parString2.startsWith("{")) {
|
||||
parString2 = parString2.substring(1, parString2.length() - 1);
|
||||
|
||||
JsonToNBT.Compound jsontonbt$compound;
|
||||
String s1;
|
||||
for (jsontonbt$compound = new JsonToNBT.Compound(parString1); parString2
|
||||
.length() > 0; parString2 = parString2.substring(s1.length() + 1)) {
|
||||
s1 = func_150314_a(parString2, true);
|
||||
if (s1.length() > 0) {
|
||||
boolean flag1 = false;
|
||||
jsontonbt$compound.field_150491_b.add(func_179270_a(s1, flag1));
|
||||
}
|
||||
|
||||
if (parString2.length() < s1.length() + 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
char c1 = parString2.charAt(s1.length());
|
||||
if (c1 != 44 && c1 != 123 && c1 != 125 && c1 != 91 && c1 != 93) {
|
||||
throw new NBTException("Unexpected token \'" + c1 + "\' at: " + parString2.substring(s1.length()));
|
||||
}
|
||||
}
|
||||
|
||||
return jsontonbt$compound;
|
||||
} else if (parString2.startsWith("[") && !field_179273_b.matcher(parString2).matches()) {
|
||||
parString2 = parString2.substring(1, parString2.length() - 1);
|
||||
|
||||
JsonToNBT.List jsontonbt$list;
|
||||
String s;
|
||||
for (jsontonbt$list = new JsonToNBT.List(parString1); parString2.length() > 0; parString2 = parString2
|
||||
.substring(s.length() + 1)) {
|
||||
s = func_150314_a(parString2, false);
|
||||
if (s.length() > 0) {
|
||||
boolean flag = true;
|
||||
jsontonbt$list.field_150492_b.add(func_179270_a(s, flag));
|
||||
}
|
||||
|
||||
if (parString2.length() < s.length() + 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
char c0 = parString2.charAt(s.length());
|
||||
if (c0 != 44 && c0 != 123 && c0 != 125 && c0 != 91 && c0 != 93) {
|
||||
throw new NBTException("Unexpected token \'" + c0 + "\' at: " + parString2.substring(s.length()));
|
||||
}
|
||||
}
|
||||
|
||||
return jsontonbt$list;
|
||||
} else {
|
||||
return new JsonToNBT.Primitive(parString1, parString2);
|
||||
}
|
||||
}
|
||||
|
||||
private static JsonToNBT.Any func_179270_a(String parString1, boolean parFlag) throws NBTException {
|
||||
String s = func_150313_b(parString1, parFlag);
|
||||
String s1 = func_150311_c(parString1, parFlag);
|
||||
return func_179272_a(new String[] { s, s1 });
|
||||
}
|
||||
|
||||
private static String func_150314_a(String parString1, boolean parFlag) throws NBTException {
|
||||
int i = func_150312_a(parString1, ':');
|
||||
int j = func_150312_a(parString1, ',');
|
||||
if (parFlag) {
|
||||
if (i == -1) {
|
||||
throw new NBTException("Unable to locate name/value separator for string: " + parString1);
|
||||
}
|
||||
|
||||
if (j != -1 && j < i) {
|
||||
throw new NBTException("Name error at: " + parString1);
|
||||
}
|
||||
} else if (i == -1 || i > j) {
|
||||
i = -1;
|
||||
}
|
||||
|
||||
return func_179269_a(parString1, i);
|
||||
}
|
||||
|
||||
private static String func_179269_a(String parString1, int parInt1) throws NBTException {
|
||||
Stack stack = new Stack();
|
||||
int i = parInt1 + 1;
|
||||
boolean flag = false;
|
||||
boolean flag1 = false;
|
||||
boolean flag2 = false;
|
||||
|
||||
for (int j = 0; i < parString1.length(); ++i) {
|
||||
char c0 = parString1.charAt(i);
|
||||
if (c0 == 34) {
|
||||
if (func_179271_b(parString1, i)) {
|
||||
if (!flag) {
|
||||
throw new NBTException("Illegal use of \\\": " + parString1);
|
||||
}
|
||||
} else {
|
||||
flag = !flag;
|
||||
if (flag && !flag2) {
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
if (!flag) {
|
||||
j = i;
|
||||
}
|
||||
}
|
||||
} else if (!flag) {
|
||||
if (c0 != 123 && c0 != 91) {
|
||||
if (c0 == 125 && (stack.isEmpty() || ((Character) stack.pop()).charValue() != 123)) {
|
||||
throw new NBTException("Unbalanced curly brackets {}: " + parString1);
|
||||
}
|
||||
|
||||
if (c0 == 93 && (stack.isEmpty() || ((Character) stack.pop()).charValue() != 91)) {
|
||||
throw new NBTException("Unbalanced square brackets []: " + parString1);
|
||||
}
|
||||
|
||||
if (c0 == 44 && stack.isEmpty()) {
|
||||
return parString1.substring(0, i);
|
||||
}
|
||||
} else {
|
||||
stack.push(Character.valueOf(c0));
|
||||
}
|
||||
}
|
||||
|
||||
if (!Character.isWhitespace(c0)) {
|
||||
if (!flag && flag1 && j != i) {
|
||||
return parString1.substring(0, j + 1);
|
||||
}
|
||||
|
||||
flag2 = true;
|
||||
}
|
||||
}
|
||||
|
||||
return parString1.substring(0, i);
|
||||
}
|
||||
|
||||
private static String func_150313_b(String parString1, boolean parFlag) throws NBTException {
|
||||
if (parFlag) {
|
||||
parString1 = parString1.trim();
|
||||
if (parString1.startsWith("{") || parString1.startsWith("[")) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
int i = func_150312_a(parString1, ':');
|
||||
if (i == -1) {
|
||||
if (parFlag) {
|
||||
return "";
|
||||
} else {
|
||||
throw new NBTException("Unable to locate name/value separator for string: " + parString1);
|
||||
}
|
||||
} else {
|
||||
return parString1.substring(0, i).trim();
|
||||
}
|
||||
}
|
||||
|
||||
private static String func_150311_c(String parString1, boolean parFlag) throws NBTException {
|
||||
if (parFlag) {
|
||||
parString1 = parString1.trim();
|
||||
if (parString1.startsWith("{") || parString1.startsWith("[")) {
|
||||
return parString1;
|
||||
}
|
||||
}
|
||||
|
||||
int i = func_150312_a(parString1, ':');
|
||||
if (i == -1) {
|
||||
if (parFlag) {
|
||||
return parString1;
|
||||
} else {
|
||||
throw new NBTException("Unable to locate name/value separator for string: " + parString1);
|
||||
}
|
||||
} else {
|
||||
return parString1.substring(i + 1).trim();
|
||||
}
|
||||
}
|
||||
|
||||
private static int func_150312_a(String parString1, char parChar1) {
|
||||
int i = 0;
|
||||
|
||||
for (boolean flag = true; i < parString1.length(); ++i) {
|
||||
char c0 = parString1.charAt(i);
|
||||
if (c0 == 34) {
|
||||
if (!func_179271_b(parString1, i)) {
|
||||
flag = !flag;
|
||||
}
|
||||
} else if (flag) {
|
||||
if (c0 == parChar1) {
|
||||
return i;
|
||||
}
|
||||
|
||||
if (c0 == 123 || c0 == 91) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static boolean func_179271_b(String parString1, int parInt1) {
|
||||
return parInt1 > 0 && parString1.charAt(parInt1 - 1) == 92 && !func_179271_b(parString1, parInt1 - 1);
|
||||
}
|
||||
|
||||
abstract static class Any {
|
||||
protected String json;
|
||||
|
||||
public abstract NBTBase parse() throws NBTException;
|
||||
}
|
||||
|
||||
static class Compound extends JsonToNBT.Any {
|
||||
protected java.util.List<JsonToNBT.Any> field_150491_b = Lists.newArrayList();
|
||||
|
||||
public Compound(String parString1) {
|
||||
this.json = parString1;
|
||||
}
|
||||
|
||||
public NBTBase parse() throws NBTException {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
|
||||
for (int i = 0, l = this.field_150491_b.size(); i < l; ++i) {
|
||||
JsonToNBT.Any jsontonbt$any = this.field_150491_b.get(i);
|
||||
nbttagcompound.setTag(jsontonbt$any.json, jsontonbt$any.parse());
|
||||
}
|
||||
|
||||
return nbttagcompound;
|
||||
}
|
||||
}
|
||||
|
||||
static class List extends JsonToNBT.Any {
|
||||
protected java.util.List<JsonToNBT.Any> field_150492_b = Lists.newArrayList();
|
||||
|
||||
public List(String json) {
|
||||
this.json = json;
|
||||
}
|
||||
|
||||
public NBTBase parse() throws NBTException {
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0, l = this.field_150492_b.size(); i < l; ++i) {
|
||||
nbttaglist.appendTag(this.field_150492_b.get(i).parse());
|
||||
}
|
||||
|
||||
return nbttaglist;
|
||||
}
|
||||
}
|
||||
|
||||
static class Primitive extends JsonToNBT.Any {
|
||||
private static final Pattern DOUBLE = Pattern.compile("[-+]?[0-9]*\\.?[0-9]+[d|D]");
|
||||
private static final Pattern FLOAT = Pattern.compile("[-+]?[0-9]*\\.?[0-9]+[f|F]");
|
||||
private static final Pattern BYTE = Pattern.compile("[-+]?[0-9]+[b|B]");
|
||||
private static final Pattern LONG = Pattern.compile("[-+]?[0-9]+[l|L]");
|
||||
private static final Pattern SHORT = Pattern.compile("[-+]?[0-9]+[s|S]");
|
||||
private static final Pattern INTEGER = Pattern.compile("[-+]?[0-9]+");
|
||||
private static final Pattern DOUBLE_UNTYPED = Pattern.compile("[-+]?[0-9]*\\.?[0-9]+");
|
||||
private static final Splitter SPLITTER = Splitter.on(',').omitEmptyStrings();
|
||||
protected String jsonValue;
|
||||
|
||||
public Primitive(String parString1, String parString2) {
|
||||
this.json = parString1;
|
||||
this.jsonValue = parString2;
|
||||
}
|
||||
|
||||
public NBTBase parse() throws NBTException {
|
||||
try {
|
||||
if (DOUBLE.matcher(this.jsonValue).matches()) {
|
||||
return new NBTTagDouble(
|
||||
Double.parseDouble(this.jsonValue.substring(0, this.jsonValue.length() - 1)));
|
||||
}
|
||||
|
||||
if (FLOAT.matcher(this.jsonValue).matches()) {
|
||||
return new NBTTagFloat(Float.parseFloat(this.jsonValue.substring(0, this.jsonValue.length() - 1)));
|
||||
}
|
||||
|
||||
if (BYTE.matcher(this.jsonValue).matches()) {
|
||||
return new NBTTagByte(Byte.parseByte(this.jsonValue.substring(0, this.jsonValue.length() - 1)));
|
||||
}
|
||||
|
||||
if (LONG.matcher(this.jsonValue).matches()) {
|
||||
return new NBTTagLong(Long.parseLong(this.jsonValue.substring(0, this.jsonValue.length() - 1)));
|
||||
}
|
||||
|
||||
if (SHORT.matcher(this.jsonValue).matches()) {
|
||||
return new NBTTagShort(Short.parseShort(this.jsonValue.substring(0, this.jsonValue.length() - 1)));
|
||||
}
|
||||
|
||||
if (INTEGER.matcher(this.jsonValue).matches()) {
|
||||
return new NBTTagInt(Integer.parseInt(this.jsonValue));
|
||||
}
|
||||
|
||||
if (DOUBLE_UNTYPED.matcher(this.jsonValue).matches()) {
|
||||
return new NBTTagDouble(Double.parseDouble(this.jsonValue));
|
||||
}
|
||||
|
||||
if (this.jsonValue.equalsIgnoreCase("true") || this.jsonValue.equalsIgnoreCase("false")) {
|
||||
return new NBTTagByte((byte) (Boolean.parseBoolean(this.jsonValue) ? 1 : 0));
|
||||
}
|
||||
} catch (NumberFormatException var6) {
|
||||
this.jsonValue = this.jsonValue.replaceAll("\\\\\"", "\"");
|
||||
return new NBTTagString(this.jsonValue);
|
||||
}
|
||||
|
||||
if (this.jsonValue.startsWith("[") && this.jsonValue.endsWith("]")) {
|
||||
String s = this.jsonValue.substring(1, this.jsonValue.length() - 1);
|
||||
String[] astring = (String[]) Iterables.toArray(SPLITTER.split(s), String.class);
|
||||
|
||||
try {
|
||||
int[] aint = new int[astring.length];
|
||||
|
||||
for (int j = 0; j < astring.length; ++j) {
|
||||
aint[j] = Integer.parseInt(astring[j].trim());
|
||||
}
|
||||
|
||||
return new NBTTagIntArray(aint);
|
||||
} catch (NumberFormatException var5) {
|
||||
return new NBTTagString(this.jsonValue);
|
||||
}
|
||||
} else {
|
||||
if (this.jsonValue.startsWith("\"") && this.jsonValue.endsWith("\"")) {
|
||||
this.jsonValue = this.jsonValue.substring(1, this.jsonValue.length() - 1);
|
||||
}
|
||||
|
||||
this.jsonValue = this.jsonValue.replaceAll("\\\\\"", "\"");
|
||||
StringBuilder stringbuilder = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < this.jsonValue.length(); ++i) {
|
||||
if (i < this.jsonValue.length() - 1 && this.jsonValue.charAt(i) == 92
|
||||
&& this.jsonValue.charAt(i + 1) == 92) {
|
||||
stringbuilder.append('\\');
|
||||
++i;
|
||||
} else {
|
||||
stringbuilder.append(this.jsonValue.charAt(i));
|
||||
}
|
||||
}
|
||||
|
||||
return new NBTTagString(stringbuilder.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+113
@@ -0,0 +1,113 @@
|
||||
package net.minecraft.nbt;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public abstract class NBTBase {
|
||||
public static final String[] NBT_TYPES = new String[] { "END", "BYTE", "SHORT", "INT", "LONG", "FLOAT", "DOUBLE",
|
||||
"BYTE[]", "STRING", "LIST", "COMPOUND", "INT[]" };
|
||||
|
||||
abstract void write(DataOutput var1) throws IOException;
|
||||
|
||||
abstract void read(DataInput var1, int var2, NBTSizeTracker var3) throws IOException;
|
||||
|
||||
public abstract String toString();
|
||||
|
||||
public abstract byte getId();
|
||||
|
||||
/**+
|
||||
* Creates a new NBTBase object that corresponds with the passed
|
||||
* in id.
|
||||
*/
|
||||
protected static NBTBase createNewByType(byte id) {
|
||||
switch (id) {
|
||||
case 0:
|
||||
return new NBTTagEnd();
|
||||
case 1:
|
||||
return new NBTTagByte();
|
||||
case 2:
|
||||
return new NBTTagShort();
|
||||
case 3:
|
||||
return new NBTTagInt();
|
||||
case 4:
|
||||
return new NBTTagLong();
|
||||
case 5:
|
||||
return new NBTTagFloat();
|
||||
case 6:
|
||||
return new NBTTagDouble();
|
||||
case 7:
|
||||
return new NBTTagByteArray();
|
||||
case 8:
|
||||
return new NBTTagString();
|
||||
case 9:
|
||||
return new NBTTagList();
|
||||
case 10:
|
||||
return new NBTTagCompound();
|
||||
case 11:
|
||||
return new NBTTagIntArray();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract NBTBase copy();
|
||||
|
||||
/**+
|
||||
* Return whether this compound has no tags.
|
||||
*/
|
||||
public boolean hasNoTags() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (!(object instanceof NBTBase)) {
|
||||
return false;
|
||||
} else {
|
||||
NBTBase nbtbase = (NBTBase) object;
|
||||
return this.getId() == nbtbase.getId();
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.getId();
|
||||
}
|
||||
|
||||
protected String getString() {
|
||||
return this.toString();
|
||||
}
|
||||
|
||||
public abstract static class NBTPrimitive extends NBTBase {
|
||||
public abstract long getLong();
|
||||
|
||||
public abstract int getInt();
|
||||
|
||||
public abstract short getShort();
|
||||
|
||||
public abstract byte getByte();
|
||||
|
||||
public abstract double getDouble();
|
||||
|
||||
public abstract float getFloat();
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package net.minecraft.nbt;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class NBTException extends Exception {
|
||||
public NBTException(String parString1) {
|
||||
super(parString1);
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package net.minecraft.nbt;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class NBTSizeTracker {
|
||||
public static final NBTSizeTracker INFINITE = new NBTSizeTracker(0L) {
|
||||
/**+
|
||||
* Tracks the reading of the given amount of bits(!)
|
||||
*/
|
||||
public void read(long bits) {
|
||||
}
|
||||
};
|
||||
private final long max;
|
||||
private long read;
|
||||
|
||||
public NBTSizeTracker(long max) {
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Tracks the reading of the given amount of bits(!)
|
||||
*/
|
||||
public void read(long i) {
|
||||
this.read += i / 8L;
|
||||
if (this.read > this.max) {
|
||||
throw new RuntimeException("Tried to read NBT tag that was too big; tried to allocate: " + this.read
|
||||
+ "bytes where max allowed: " + this.max);
|
||||
}
|
||||
}
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
package net.minecraft.nbt;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class NBTTagByte extends NBTBase.NBTPrimitive {
|
||||
private byte data;
|
||||
|
||||
NBTTagByte() {
|
||||
}
|
||||
|
||||
public NBTTagByte(byte data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Write the actual data contents of the tag, implemented in NBT
|
||||
* extension classes
|
||||
*/
|
||||
void write(DataOutput parDataOutput) throws IOException {
|
||||
parDataOutput.writeByte(this.data);
|
||||
}
|
||||
|
||||
void read(DataInput parDataInput, int parInt1, NBTSizeTracker parNBTSizeTracker) throws IOException {
|
||||
parNBTSizeTracker.read(72L);
|
||||
this.data = parDataInput.readByte();
|
||||
}
|
||||
|
||||
/**+
|
||||
* Gets the type byte for the tag.
|
||||
*/
|
||||
public byte getId() {
|
||||
return (byte) 1;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "" + this.data + "b";
|
||||
}
|
||||
|
||||
/**+
|
||||
* Creates a clone of the tag.
|
||||
*/
|
||||
public NBTBase copy() {
|
||||
return new NBTTagByte(this.data);
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (super.equals(object)) {
|
||||
NBTTagByte nbttagbyte = (NBTTagByte) object;
|
||||
return this.data == nbttagbyte.data;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return super.hashCode() ^ this.data;
|
||||
}
|
||||
|
||||
public long getLong() {
|
||||
return (long) this.data;
|
||||
}
|
||||
|
||||
public int getInt() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
public short getShort() {
|
||||
return (short) this.data;
|
||||
}
|
||||
|
||||
public byte getByte() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
public double getDouble() {
|
||||
return (double) this.data;
|
||||
}
|
||||
|
||||
public float getFloat() {
|
||||
return (float) this.data;
|
||||
}
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package net.minecraft.nbt;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class NBTTagByteArray extends NBTBase {
|
||||
private byte[] data;
|
||||
|
||||
NBTTagByteArray() {
|
||||
}
|
||||
|
||||
public NBTTagByteArray(byte[] data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Write the actual data contents of the tag, implemented in NBT
|
||||
* extension classes
|
||||
*/
|
||||
void write(DataOutput output) throws IOException {
|
||||
output.writeInt(this.data.length);
|
||||
output.write(this.data);
|
||||
}
|
||||
|
||||
void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException {
|
||||
sizeTracker.read(192L);
|
||||
int i = input.readInt();
|
||||
sizeTracker.read((long) (8 * i));
|
||||
this.data = new byte[i];
|
||||
input.readFully(this.data);
|
||||
}
|
||||
|
||||
/**+
|
||||
* Gets the type byte for the tag.
|
||||
*/
|
||||
public byte getId() {
|
||||
return (byte) 7;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "[" + this.data.length + " bytes]";
|
||||
}
|
||||
|
||||
/**+
|
||||
* Creates a clone of the tag.
|
||||
*/
|
||||
public NBTBase copy() {
|
||||
byte[] abyte = new byte[this.data.length];
|
||||
System.arraycopy(this.data, 0, abyte, 0, this.data.length);
|
||||
return new NBTTagByteArray(abyte);
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
return super.equals(object) ? Arrays.equals(this.data, ((NBTTagByteArray) object).data) : false;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return super.hashCode() ^ Arrays.hashCode(this.data);
|
||||
}
|
||||
|
||||
public byte[] getByteArray() {
|
||||
return this.data;
|
||||
}
|
||||
}
|
||||
+489
@@ -0,0 +1,489 @@
|
||||
package net.minecraft.nbt;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraft.crash.CrashReport;
|
||||
import net.minecraft.crash.CrashReportCategory;
|
||||
import net.minecraft.util.ReportedException;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class NBTTagCompound extends NBTBase {
|
||||
private Map<String, NBTBase> tagMap = Maps.newHashMap();
|
||||
|
||||
/**+
|
||||
* Write the actual data contents of the tag, implemented in NBT
|
||||
* extension classes
|
||||
*/
|
||||
void write(DataOutput parDataOutput) throws IOException {
|
||||
for (String s : this.tagMap.keySet()) {
|
||||
NBTBase nbtbase = (NBTBase) this.tagMap.get(s);
|
||||
writeEntry(s, nbtbase, parDataOutput);
|
||||
}
|
||||
|
||||
parDataOutput.writeByte(0);
|
||||
}
|
||||
|
||||
void read(DataInput parDataInput, int parInt1, NBTSizeTracker parNBTSizeTracker) throws IOException {
|
||||
parNBTSizeTracker.read(384L);
|
||||
if (parInt1 > 512) {
|
||||
throw new RuntimeException("Tried to read NBT tag with too high complexity, depth > 512");
|
||||
} else {
|
||||
this.tagMap.clear();
|
||||
|
||||
byte b0;
|
||||
while ((b0 = readType(parDataInput, parNBTSizeTracker)) != 0) {
|
||||
String s = readKey(parDataInput, parNBTSizeTracker);
|
||||
parNBTSizeTracker.read((long) (224 + 16 * s.length()));
|
||||
NBTBase nbtbase = readNBT(b0, s, parDataInput, parInt1 + 1, parNBTSizeTracker);
|
||||
if (this.tagMap.put(s, nbtbase) != null) {
|
||||
parNBTSizeTracker.read(288L);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Gets a set with the names of the keys in the tag compound.
|
||||
*/
|
||||
public Set<String> getKeySet() {
|
||||
return this.tagMap.keySet();
|
||||
}
|
||||
|
||||
/**+
|
||||
* Gets the type byte for the tag.
|
||||
*/
|
||||
public byte getId() {
|
||||
return (byte) 10;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Stores the given tag into the map with the given string key.
|
||||
* This is mostly used to store tag lists.
|
||||
*/
|
||||
public void setTag(String key, NBTBase value) {
|
||||
this.tagMap.put(key, value);
|
||||
}
|
||||
|
||||
/**+
|
||||
* Stores a new NBTTagByte with the given byte value into the
|
||||
* map with the given string key.
|
||||
*/
|
||||
public void setByte(String key, byte value) {
|
||||
this.tagMap.put(key, new NBTTagByte(value));
|
||||
}
|
||||
|
||||
/**+
|
||||
* Stores a new NBTTagShort with the given short value into the
|
||||
* map with the given string key.
|
||||
*/
|
||||
public void setShort(String key, short value) {
|
||||
this.tagMap.put(key, new NBTTagShort(value));
|
||||
}
|
||||
|
||||
/**+
|
||||
* Stores a new NBTTagInt with the given integer value into the
|
||||
* map with the given string key.
|
||||
*/
|
||||
public void setInteger(String key, int value) {
|
||||
this.tagMap.put(key, new NBTTagInt(value));
|
||||
}
|
||||
|
||||
/**+
|
||||
* Stores a new NBTTagLong with the given long value into the
|
||||
* map with the given string key.
|
||||
*/
|
||||
public void setLong(String key, long value) {
|
||||
this.tagMap.put(key, new NBTTagLong(value));
|
||||
}
|
||||
|
||||
/**+
|
||||
* Stores a new NBTTagFloat with the given float value into the
|
||||
* map with the given string key.
|
||||
*/
|
||||
public void setFloat(String key, float value) {
|
||||
this.tagMap.put(key, new NBTTagFloat(value));
|
||||
}
|
||||
|
||||
/**+
|
||||
* Stores a new NBTTagDouble with the given double value into
|
||||
* the map with the given string key.
|
||||
*/
|
||||
public void setDouble(String key, double value) {
|
||||
this.tagMap.put(key, new NBTTagDouble(value));
|
||||
}
|
||||
|
||||
/**+
|
||||
* Stores a new NBTTagString with the given string value into
|
||||
* the map with the given string key.
|
||||
*/
|
||||
public void setString(String key, String value) {
|
||||
this.tagMap.put(key, new NBTTagString(value));
|
||||
}
|
||||
|
||||
/**+
|
||||
* Stores a new NBTTagByteArray with the given array as data
|
||||
* into the map with the given string key.
|
||||
*/
|
||||
public void setByteArray(String key, byte[] value) {
|
||||
this.tagMap.put(key, new NBTTagByteArray(value));
|
||||
}
|
||||
|
||||
/**+
|
||||
* Stores a new NBTTagIntArray with the given array as data into
|
||||
* the map with the given string key.
|
||||
*/
|
||||
public void setIntArray(String key, int[] value) {
|
||||
this.tagMap.put(key, new NBTTagIntArray(value));
|
||||
}
|
||||
|
||||
/**+
|
||||
* Stores the given boolean value as a NBTTagByte, storing 1 for
|
||||
* true and 0 for false, using the given string key.
|
||||
*/
|
||||
public void setBoolean(String key, boolean value) {
|
||||
this.setByte(key, (byte) (value ? 1 : 0));
|
||||
}
|
||||
|
||||
/**+
|
||||
* gets a generic tag with the specified name
|
||||
*/
|
||||
public NBTBase getTag(String key) {
|
||||
return (NBTBase) this.tagMap.get(key);
|
||||
}
|
||||
|
||||
/**+
|
||||
* Gets the ID byte for the given tag key
|
||||
*/
|
||||
public byte getTagId(String key) {
|
||||
NBTBase nbtbase = (NBTBase) this.tagMap.get(key);
|
||||
return nbtbase != null ? nbtbase.getId() : 0;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Returns whether the given string has been previously stored
|
||||
* as a key in the map.
|
||||
*/
|
||||
public boolean hasKey(String key) {
|
||||
return this.tagMap.containsKey(key);
|
||||
}
|
||||
|
||||
/**+
|
||||
* Returns whether the given string has been previously stored
|
||||
* as a key in the map.
|
||||
*/
|
||||
public boolean hasKey(String key, int type) {
|
||||
byte b0 = this.getTagId(key);
|
||||
if (b0 == type) {
|
||||
return true;
|
||||
} else if (type != 99) {
|
||||
if (b0 > 0) {
|
||||
;
|
||||
}
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return b0 == 1 || b0 == 2 || b0 == 3 || b0 == 4 || b0 == 5 || b0 == 6;
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Retrieves a byte value using the specified key, or 0 if no
|
||||
* such key was stored.
|
||||
*/
|
||||
public byte getByte(String key) {
|
||||
try {
|
||||
return !this.hasKey(key, 99) ? 0 : ((NBTBase.NBTPrimitive) this.tagMap.get(key)).getByte();
|
||||
} catch (ClassCastException var3) {
|
||||
return (byte) 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Retrieves a short value using the specified key, or 0 if no
|
||||
* such key was stored.
|
||||
*/
|
||||
public short getShort(String key) {
|
||||
try {
|
||||
return !this.hasKey(key, 99) ? 0 : ((NBTBase.NBTPrimitive) this.tagMap.get(key)).getShort();
|
||||
} catch (ClassCastException var3) {
|
||||
return (short) 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Retrieves an integer value using the specified key, or 0 if
|
||||
* no such key was stored.
|
||||
*/
|
||||
public int getInteger(String key) {
|
||||
try {
|
||||
return !this.hasKey(key, 99) ? 0 : ((NBTBase.NBTPrimitive) this.tagMap.get(key)).getInt();
|
||||
} catch (ClassCastException var3) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Retrieves a long value using the specified key, or 0 if no
|
||||
* such key was stored.
|
||||
*/
|
||||
public long getLong(String key) {
|
||||
try {
|
||||
return !this.hasKey(key, 99) ? 0L : ((NBTBase.NBTPrimitive) this.tagMap.get(key)).getLong();
|
||||
} catch (ClassCastException var3) {
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Retrieves a float value using the specified key, or 0 if no
|
||||
* such key was stored.
|
||||
*/
|
||||
public float getFloat(String key) {
|
||||
try {
|
||||
return !this.hasKey(key, 99) ? 0.0F : ((NBTBase.NBTPrimitive) this.tagMap.get(key)).getFloat();
|
||||
} catch (ClassCastException var3) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Retrieves a double value using the specified key, or 0 if no
|
||||
* such key was stored.
|
||||
*/
|
||||
public double getDouble(String key) {
|
||||
try {
|
||||
return !this.hasKey(key, 99) ? 0.0D : ((NBTBase.NBTPrimitive) this.tagMap.get(key)).getDouble();
|
||||
} catch (ClassCastException var3) {
|
||||
return 0.0D;
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Retrieves a string value using the specified key, or an empty
|
||||
* string if no such key was stored.
|
||||
*/
|
||||
public String getString(String key) {
|
||||
try {
|
||||
return !this.hasKey(key, 8) ? "" : ((NBTBase) this.tagMap.get(key)).getString();
|
||||
} catch (ClassCastException var3) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Retrieves a byte array using the specified key, or a
|
||||
* zero-length array if no such key was stored.
|
||||
*/
|
||||
public byte[] getByteArray(String key) {
|
||||
try {
|
||||
return !this.hasKey(key, 7) ? new byte[0] : ((NBTTagByteArray) this.tagMap.get(key)).getByteArray();
|
||||
} catch (ClassCastException classcastexception) {
|
||||
throw new ReportedException(this.createCrashReport(key, 7, classcastexception));
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Retrieves an int array using the specified key, or a
|
||||
* zero-length array if no such key was stored.
|
||||
*/
|
||||
public int[] getIntArray(String key) {
|
||||
try {
|
||||
return !this.hasKey(key, 11) ? new int[0] : ((NBTTagIntArray) this.tagMap.get(key)).getIntArray();
|
||||
} catch (ClassCastException classcastexception) {
|
||||
throw new ReportedException(this.createCrashReport(key, 11, classcastexception));
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Retrieves a NBTTagCompound subtag matching the specified key,
|
||||
* or a new empty NBTTagCompound if no such key was stored.
|
||||
*/
|
||||
public NBTTagCompound getCompoundTag(String key) {
|
||||
try {
|
||||
return !this.hasKey(key, 10) ? new NBTTagCompound() : (NBTTagCompound) this.tagMap.get(key);
|
||||
} catch (ClassCastException classcastexception) {
|
||||
throw new ReportedException(this.createCrashReport(key, 10, classcastexception));
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Gets the NBTTagList object with the given name. Args: name,
|
||||
* NBTBase type
|
||||
*/
|
||||
public NBTTagList getTagList(String key, int type) {
|
||||
try {
|
||||
if (this.getTagId(key) != 9) {
|
||||
return new NBTTagList();
|
||||
} else {
|
||||
NBTTagList nbttaglist = (NBTTagList) this.tagMap.get(key);
|
||||
return nbttaglist.tagCount() > 0 && nbttaglist.getTagType() != type ? new NBTTagList() : nbttaglist;
|
||||
}
|
||||
} catch (ClassCastException classcastexception) {
|
||||
throw new ReportedException(this.createCrashReport(key, 9, classcastexception));
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Retrieves a boolean value using the specified key, or false
|
||||
* if no such key was stored. This uses the getByte method.
|
||||
*/
|
||||
public boolean getBoolean(String key) {
|
||||
return this.getByte(key) != 0;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Remove the specified tag.
|
||||
*/
|
||||
public void removeTag(String key) {
|
||||
this.tagMap.remove(key);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder stringbuilder = new StringBuilder("{");
|
||||
|
||||
for (Entry entry : this.tagMap.entrySet()) {
|
||||
if (stringbuilder.length() != 1) {
|
||||
stringbuilder.append(',');
|
||||
}
|
||||
|
||||
stringbuilder.append((String) entry.getKey()).append(':').append(entry.getValue());
|
||||
}
|
||||
|
||||
return stringbuilder.append('}').toString();
|
||||
}
|
||||
|
||||
/**+
|
||||
* Return whether this compound has no tags.
|
||||
*/
|
||||
public boolean hasNoTags() {
|
||||
return this.tagMap.isEmpty();
|
||||
}
|
||||
|
||||
/**+
|
||||
* Create a crash report which indicates a NBT read error.
|
||||
*/
|
||||
private CrashReport createCrashReport(final String key, final int expectedType, ClassCastException ex) {
|
||||
CrashReport crashreport = CrashReport.makeCrashReport(ex, "Reading NBT data");
|
||||
CrashReportCategory crashreportcategory = crashreport.makeCategoryDepth("Corrupt NBT tag", 1);
|
||||
crashreportcategory.addCrashSectionCallable("Tag type found", new Callable<String>() {
|
||||
public String call() throws Exception {
|
||||
return NBTBase.NBT_TYPES[((NBTBase) NBTTagCompound.this.tagMap.get(key)).getId()];
|
||||
}
|
||||
});
|
||||
crashreportcategory.addCrashSectionCallable("Tag type expected", new Callable<String>() {
|
||||
public String call() throws Exception {
|
||||
return NBTBase.NBT_TYPES[expectedType];
|
||||
}
|
||||
});
|
||||
crashreportcategory.addCrashSection("Tag name", key);
|
||||
return crashreport;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Creates a clone of the tag.
|
||||
*/
|
||||
public NBTBase copy() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
|
||||
for (String s : this.tagMap.keySet()) {
|
||||
nbttagcompound.setTag(s, ((NBTBase) this.tagMap.get(s)).copy());
|
||||
}
|
||||
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (super.equals(object)) {
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) object;
|
||||
return this.tagMap.entrySet().equals(nbttagcompound.tagMap.entrySet());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return super.hashCode() ^ this.tagMap.hashCode();
|
||||
}
|
||||
|
||||
private static void writeEntry(String name, NBTBase data, DataOutput output) throws IOException {
|
||||
output.writeByte(data.getId());
|
||||
if (data.getId() != 0) {
|
||||
output.writeUTF(name);
|
||||
data.write(output);
|
||||
}
|
||||
}
|
||||
|
||||
private static byte readType(DataInput input, NBTSizeTracker sizeTracker) throws IOException {
|
||||
return input.readByte();
|
||||
}
|
||||
|
||||
private static String readKey(DataInput input, NBTSizeTracker sizeTracker) throws IOException {
|
||||
return input.readUTF();
|
||||
}
|
||||
|
||||
static NBTBase readNBT(byte id, String key, DataInput input, int depth, NBTSizeTracker sizeTracker)
|
||||
throws IOException {
|
||||
NBTBase nbtbase = NBTBase.createNewByType(id);
|
||||
|
||||
try {
|
||||
nbtbase.read(input, depth, sizeTracker);
|
||||
return nbtbase;
|
||||
} catch (IOException ioexception) {
|
||||
CrashReport crashreport = CrashReport.makeCrashReport(ioexception, "Loading NBT data");
|
||||
CrashReportCategory crashreportcategory = crashreport.makeCategory("NBT Tag");
|
||||
crashreportcategory.addCrashSection("Tag name", key);
|
||||
crashreportcategory.addCrashSection("Tag type", Byte.valueOf(id));
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Merges this NBTTagCompound with the given compound. Any
|
||||
* sub-compounds are merged using the same methods, other types
|
||||
* of tags are overwritten from the given compound.
|
||||
*/
|
||||
public void merge(NBTTagCompound other) {
|
||||
for (String s : other.tagMap.keySet()) {
|
||||
NBTBase nbtbase = (NBTBase) other.tagMap.get(s);
|
||||
if (nbtbase.getId() == 10) {
|
||||
if (this.hasKey(s, 10)) {
|
||||
NBTTagCompound nbttagcompound = this.getCompoundTag(s);
|
||||
nbttagcompound.merge((NBTTagCompound) nbtbase);
|
||||
} else {
|
||||
this.setTag(s, nbtbase.copy());
|
||||
}
|
||||
} else {
|
||||
this.setTag(s, nbtbase.copy());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package net.minecraft.nbt;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class NBTTagDouble extends NBTBase.NBTPrimitive {
|
||||
private double data;
|
||||
|
||||
NBTTagDouble() {
|
||||
}
|
||||
|
||||
public NBTTagDouble(double data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Write the actual data contents of the tag, implemented in NBT
|
||||
* extension classes
|
||||
*/
|
||||
void write(DataOutput parDataOutput) throws IOException {
|
||||
parDataOutput.writeDouble(this.data);
|
||||
}
|
||||
|
||||
void read(DataInput parDataInput, int parInt1, NBTSizeTracker parNBTSizeTracker) throws IOException {
|
||||
parNBTSizeTracker.read(128L);
|
||||
this.data = parDataInput.readDouble();
|
||||
}
|
||||
|
||||
/**+
|
||||
* Gets the type byte for the tag.
|
||||
*/
|
||||
public byte getId() {
|
||||
return (byte) 6;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "" + this.data + "d";
|
||||
}
|
||||
|
||||
/**+
|
||||
* Creates a clone of the tag.
|
||||
*/
|
||||
public NBTBase copy() {
|
||||
return new NBTTagDouble(this.data);
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (super.equals(object)) {
|
||||
NBTTagDouble nbttagdouble = (NBTTagDouble) object;
|
||||
return this.data == nbttagdouble.data;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
long i = Double.doubleToLongBits(this.data);
|
||||
return super.hashCode() ^ (int) (i ^ i >>> 32);
|
||||
}
|
||||
|
||||
public long getLong() {
|
||||
return (long) Math.floor(this.data);
|
||||
}
|
||||
|
||||
public int getInt() {
|
||||
return MathHelper.floor_double(this.data);
|
||||
}
|
||||
|
||||
public short getShort() {
|
||||
return (short) (MathHelper.floor_double(this.data) & '\uffff');
|
||||
}
|
||||
|
||||
public byte getByte() {
|
||||
return (byte) (MathHelper.floor_double(this.data) & 255);
|
||||
}
|
||||
|
||||
public double getDouble() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
public float getFloat() {
|
||||
return (float) this.data;
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package net.minecraft.nbt;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class NBTTagEnd extends NBTBase {
|
||||
void read(DataInput parDataInput, int parInt1, NBTSizeTracker parNBTSizeTracker) throws IOException {
|
||||
parNBTSizeTracker.read(64L);
|
||||
}
|
||||
|
||||
/**+
|
||||
* Write the actual data contents of the tag, implemented in NBT
|
||||
* extension classes
|
||||
*/
|
||||
void write(DataOutput parDataOutput) throws IOException {
|
||||
}
|
||||
|
||||
/**+
|
||||
* Gets the type byte for the tag.
|
||||
*/
|
||||
public byte getId() {
|
||||
return (byte) 0;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "END";
|
||||
}
|
||||
|
||||
/**+
|
||||
* Creates a clone of the tag.
|
||||
*/
|
||||
public NBTBase copy() {
|
||||
return new NBTTagEnd();
|
||||
}
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package net.minecraft.nbt;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class NBTTagFloat extends NBTBase.NBTPrimitive {
|
||||
private float data;
|
||||
|
||||
NBTTagFloat() {
|
||||
}
|
||||
|
||||
public NBTTagFloat(float data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Write the actual data contents of the tag, implemented in NBT
|
||||
* extension classes
|
||||
*/
|
||||
void write(DataOutput parDataOutput) throws IOException {
|
||||
parDataOutput.writeFloat(this.data);
|
||||
}
|
||||
|
||||
void read(DataInput parDataInput, int parInt1, NBTSizeTracker parNBTSizeTracker) throws IOException {
|
||||
parNBTSizeTracker.read(96L);
|
||||
this.data = parDataInput.readFloat();
|
||||
}
|
||||
|
||||
/**+
|
||||
* Gets the type byte for the tag.
|
||||
*/
|
||||
public byte getId() {
|
||||
return (byte) 5;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "" + this.data + "f";
|
||||
}
|
||||
|
||||
/**+
|
||||
* Creates a clone of the tag.
|
||||
*/
|
||||
public NBTBase copy() {
|
||||
return new NBTTagFloat(this.data);
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (super.equals(object)) {
|
||||
NBTTagFloat nbttagfloat = (NBTTagFloat) object;
|
||||
return this.data == nbttagfloat.data;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return super.hashCode() ^ Float.floatToIntBits(this.data);
|
||||
}
|
||||
|
||||
public long getLong() {
|
||||
return (long) this.data;
|
||||
}
|
||||
|
||||
public int getInt() {
|
||||
return MathHelper.floor_float(this.data);
|
||||
}
|
||||
|
||||
public short getShort() {
|
||||
return (short) (MathHelper.floor_float(this.data) & '\uffff');
|
||||
}
|
||||
|
||||
public byte getByte() {
|
||||
return (byte) (MathHelper.floor_float(this.data) & 255);
|
||||
}
|
||||
|
||||
public double getDouble() {
|
||||
return (double) this.data;
|
||||
}
|
||||
|
||||
public float getFloat() {
|
||||
return this.data;
|
||||
}
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
package net.minecraft.nbt;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class NBTTagInt extends NBTBase.NBTPrimitive {
|
||||
private int data;
|
||||
|
||||
NBTTagInt() {
|
||||
}
|
||||
|
||||
public NBTTagInt(int data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Write the actual data contents of the tag, implemented in NBT
|
||||
* extension classes
|
||||
*/
|
||||
void write(DataOutput parDataOutput) throws IOException {
|
||||
parDataOutput.writeInt(this.data);
|
||||
}
|
||||
|
||||
void read(DataInput parDataInput, int parInt1, NBTSizeTracker parNBTSizeTracker) throws IOException {
|
||||
parNBTSizeTracker.read(96L);
|
||||
this.data = parDataInput.readInt();
|
||||
}
|
||||
|
||||
/**+
|
||||
* Gets the type byte for the tag.
|
||||
*/
|
||||
public byte getId() {
|
||||
return (byte) 3;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "" + this.data;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Creates a clone of the tag.
|
||||
*/
|
||||
public NBTBase copy() {
|
||||
return new NBTTagInt(this.data);
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (super.equals(object)) {
|
||||
NBTTagInt nbttagint = (NBTTagInt) object;
|
||||
return this.data == nbttagint.data;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return super.hashCode() ^ this.data;
|
||||
}
|
||||
|
||||
public long getLong() {
|
||||
return (long) this.data;
|
||||
}
|
||||
|
||||
public int getInt() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
public short getShort() {
|
||||
return (short) (this.data & '\uffff');
|
||||
}
|
||||
|
||||
public byte getByte() {
|
||||
return (byte) (this.data & 255);
|
||||
}
|
||||
|
||||
public double getDouble() {
|
||||
return (double) this.data;
|
||||
}
|
||||
|
||||
public float getFloat() {
|
||||
return (float) this.data;
|
||||
}
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package net.minecraft.nbt;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class NBTTagIntArray extends NBTBase {
|
||||
private int[] intArray;
|
||||
|
||||
NBTTagIntArray() {
|
||||
}
|
||||
|
||||
public NBTTagIntArray(int[] parArrayOfInt) {
|
||||
this.intArray = parArrayOfInt;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Write the actual data contents of the tag, implemented in NBT
|
||||
* extension classes
|
||||
*/
|
||||
void write(DataOutput parDataOutput) throws IOException {
|
||||
parDataOutput.writeInt(this.intArray.length);
|
||||
|
||||
for (int i = 0; i < this.intArray.length; ++i) {
|
||||
parDataOutput.writeInt(this.intArray[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void read(DataInput parDataInput, int parInt1, NBTSizeTracker parNBTSizeTracker) throws IOException {
|
||||
parNBTSizeTracker.read(192L);
|
||||
int i = parDataInput.readInt();
|
||||
parNBTSizeTracker.read((long) (32 * i));
|
||||
this.intArray = new int[i];
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
this.intArray[j] = parDataInput.readInt();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**+
|
||||
* Gets the type byte for the tag.
|
||||
*/
|
||||
public byte getId() {
|
||||
return (byte) 11;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String s = "[";
|
||||
|
||||
for (int i = 0; i < this.intArray.length; ++i) {
|
||||
s = s + this.intArray[i] + ",";
|
||||
}
|
||||
|
||||
return s + "]";
|
||||
}
|
||||
|
||||
/**+
|
||||
* Creates a clone of the tag.
|
||||
*/
|
||||
public NBTBase copy() {
|
||||
int[] aint = new int[this.intArray.length];
|
||||
System.arraycopy(this.intArray, 0, aint, 0, this.intArray.length);
|
||||
return new NBTTagIntArray(aint);
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
return super.equals(object) ? Arrays.equals(this.intArray, ((NBTTagIntArray) object).intArray) : false;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return super.hashCode() ^ Arrays.hashCode(this.intArray);
|
||||
}
|
||||
|
||||
public int[] getIntArray() {
|
||||
return this.intArray;
|
||||
}
|
||||
}
|
||||
+263
@@ -0,0 +1,263 @@
|
||||
package net.minecraft.nbt;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class NBTTagList extends NBTBase {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
/**+
|
||||
* The array list containing the tags encapsulated in this list.
|
||||
*/
|
||||
private List<NBTBase> tagList = Lists.newArrayList();
|
||||
/**+
|
||||
* The type byte for the tags in the list - they must all be of
|
||||
* the same type.
|
||||
*/
|
||||
private byte tagType = 0;
|
||||
|
||||
/**+
|
||||
* Write the actual data contents of the tag, implemented in NBT
|
||||
* extension classes
|
||||
*/
|
||||
void write(DataOutput parDataOutput) throws IOException {
|
||||
if (!this.tagList.isEmpty()) {
|
||||
this.tagType = ((NBTBase) this.tagList.get(0)).getId();
|
||||
} else {
|
||||
this.tagType = 0;
|
||||
}
|
||||
|
||||
parDataOutput.writeByte(this.tagType);
|
||||
parDataOutput.writeInt(this.tagList.size());
|
||||
|
||||
for (int i = 0; i < this.tagList.size(); ++i) {
|
||||
((NBTBase) this.tagList.get(i)).write(parDataOutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void read(DataInput parDataInput, int parInt1, NBTSizeTracker parNBTSizeTracker) throws IOException {
|
||||
parNBTSizeTracker.read(296L);
|
||||
if (parInt1 > 512) {
|
||||
throw new RuntimeException("Tried to read NBT tag with too high complexity, depth > 512");
|
||||
} else {
|
||||
this.tagType = parDataInput.readByte();
|
||||
int i = parDataInput.readInt();
|
||||
if (this.tagType == 0 && i > 0) {
|
||||
throw new RuntimeException("Missing type on ListTag");
|
||||
} else {
|
||||
parNBTSizeTracker.read(32L * (long) i);
|
||||
this.tagList = Lists.newArrayListWithCapacity(i);
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
NBTBase nbtbase = NBTBase.createNewByType(this.tagType);
|
||||
nbtbase.read(parDataInput, parInt1 + 1, parNBTSizeTracker);
|
||||
this.tagList.add(nbtbase);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Gets the type byte for the tag.
|
||||
*/
|
||||
public byte getId() {
|
||||
return (byte) 9;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder stringbuilder = new StringBuilder("[");
|
||||
|
||||
for (int i = 0; i < this.tagList.size(); ++i) {
|
||||
if (i != 0) {
|
||||
stringbuilder.append(',');
|
||||
}
|
||||
|
||||
stringbuilder.append(i).append(':').append(this.tagList.get(i));
|
||||
}
|
||||
|
||||
return stringbuilder.append(']').toString();
|
||||
}
|
||||
|
||||
/**+
|
||||
* Adds the provided tag to the end of the list. There is no
|
||||
* check to verify this tag is of the same type as any previous
|
||||
* tag.
|
||||
*/
|
||||
public void appendTag(NBTBase nbt) {
|
||||
if (nbt.getId() == 0) {
|
||||
LOGGER.warn("Invalid TagEnd added to ListTag");
|
||||
} else {
|
||||
if (this.tagType == 0) {
|
||||
this.tagType = nbt.getId();
|
||||
} else if (this.tagType != nbt.getId()) {
|
||||
LOGGER.warn("Adding mismatching tag types to tag list");
|
||||
return;
|
||||
}
|
||||
|
||||
this.tagList.add(nbt);
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Set the given index to the given tag
|
||||
*/
|
||||
public void set(int idx, NBTBase nbt) {
|
||||
if (nbt.getId() == 0) {
|
||||
LOGGER.warn("Invalid TagEnd added to ListTag");
|
||||
} else if (idx >= 0 && idx < this.tagList.size()) {
|
||||
if (this.tagType == 0) {
|
||||
this.tagType = nbt.getId();
|
||||
} else if (this.tagType != nbt.getId()) {
|
||||
LOGGER.warn("Adding mismatching tag types to tag list");
|
||||
return;
|
||||
}
|
||||
|
||||
this.tagList.set(idx, nbt);
|
||||
} else {
|
||||
LOGGER.warn("index out of bounds to set tag in tag list");
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Removes a tag at the given index.
|
||||
*/
|
||||
public NBTBase removeTag(int i) {
|
||||
return (NBTBase) this.tagList.remove(i);
|
||||
}
|
||||
|
||||
/**+
|
||||
* Return whether this compound has no tags.
|
||||
*/
|
||||
public boolean hasNoTags() {
|
||||
return this.tagList.isEmpty();
|
||||
}
|
||||
|
||||
/**+
|
||||
* Retrieves the NBTTagCompound at the specified index in the
|
||||
* list
|
||||
*/
|
||||
public NBTTagCompound getCompoundTagAt(int i) {
|
||||
if (i >= 0 && i < this.tagList.size()) {
|
||||
NBTBase nbtbase = (NBTBase) this.tagList.get(i);
|
||||
return nbtbase.getId() == 10 ? (NBTTagCompound) nbtbase : new NBTTagCompound();
|
||||
} else {
|
||||
return new NBTTagCompound();
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getIntArrayAt(int i) {
|
||||
if (i >= 0 && i < this.tagList.size()) {
|
||||
NBTBase nbtbase = (NBTBase) this.tagList.get(i);
|
||||
return nbtbase.getId() == 11 ? ((NBTTagIntArray) nbtbase).getIntArray() : new int[0];
|
||||
} else {
|
||||
return new int[0];
|
||||
}
|
||||
}
|
||||
|
||||
public double getDoubleAt(int i) {
|
||||
if (i >= 0 && i < this.tagList.size()) {
|
||||
NBTBase nbtbase = (NBTBase) this.tagList.get(i);
|
||||
return nbtbase.getId() == 6 ? ((NBTTagDouble) nbtbase).getDouble() : 0.0D;
|
||||
} else {
|
||||
return 0.0D;
|
||||
}
|
||||
}
|
||||
|
||||
public float getFloatAt(int i) {
|
||||
if (i >= 0 && i < this.tagList.size()) {
|
||||
NBTBase nbtbase = (NBTBase) this.tagList.get(i);
|
||||
return nbtbase.getId() == 5 ? ((NBTTagFloat) nbtbase).getFloat() : 0.0F;
|
||||
} else {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Retrieves the tag String value at the specified index in the
|
||||
* list
|
||||
*/
|
||||
public String getStringTagAt(int i) {
|
||||
if (i >= 0 && i < this.tagList.size()) {
|
||||
NBTBase nbtbase = (NBTBase) this.tagList.get(i);
|
||||
return nbtbase.getId() == 8 ? nbtbase.getString() : nbtbase.toString();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Get the tag at the given position
|
||||
*/
|
||||
public NBTBase get(int idx) {
|
||||
return (NBTBase) (idx >= 0 && idx < this.tagList.size() ? (NBTBase) this.tagList.get(idx) : new NBTTagEnd());
|
||||
}
|
||||
|
||||
/**+
|
||||
* Returns the number of tags in the list.
|
||||
*/
|
||||
public int tagCount() {
|
||||
return this.tagList.size();
|
||||
}
|
||||
|
||||
/**+
|
||||
* Creates a clone of the tag.
|
||||
*/
|
||||
public NBTBase copy() {
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
nbttaglist.tagType = this.tagType;
|
||||
|
||||
for (int i = 0, l = this.tagList.size(); i < l; ++i) {
|
||||
NBTBase nbtbase1 = this.tagList.get(i).copy();
|
||||
nbttaglist.tagList.add(nbtbase1);
|
||||
}
|
||||
|
||||
return nbttaglist;
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (super.equals(object)) {
|
||||
NBTTagList nbttaglist = (NBTTagList) object;
|
||||
if (this.tagType == nbttaglist.tagType) {
|
||||
return this.tagList.equals(nbttaglist.tagList);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return super.hashCode() ^ this.tagList.hashCode();
|
||||
}
|
||||
|
||||
public int getTagType() {
|
||||
return this.tagType;
|
||||
}
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
package net.minecraft.nbt;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class NBTTagLong extends NBTBase.NBTPrimitive {
|
||||
private long data;
|
||||
|
||||
NBTTagLong() {
|
||||
}
|
||||
|
||||
public NBTTagLong(long data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Write the actual data contents of the tag, implemented in NBT
|
||||
* extension classes
|
||||
*/
|
||||
void write(DataOutput parDataOutput) throws IOException {
|
||||
parDataOutput.writeLong(this.data);
|
||||
}
|
||||
|
||||
void read(DataInput parDataInput, int parInt1, NBTSizeTracker parNBTSizeTracker) throws IOException {
|
||||
parNBTSizeTracker.read(128L);
|
||||
this.data = parDataInput.readLong();
|
||||
}
|
||||
|
||||
/**+
|
||||
* Gets the type byte for the tag.
|
||||
*/
|
||||
public byte getId() {
|
||||
return (byte) 4;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "" + this.data + "L";
|
||||
}
|
||||
|
||||
/**+
|
||||
* Creates a clone of the tag.
|
||||
*/
|
||||
public NBTBase copy() {
|
||||
return new NBTTagLong(this.data);
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (super.equals(object)) {
|
||||
NBTTagLong nbttaglong = (NBTTagLong) object;
|
||||
return this.data == nbttaglong.data;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return super.hashCode() ^ (int) (this.data ^ this.data >>> 32);
|
||||
}
|
||||
|
||||
public long getLong() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
public int getInt() {
|
||||
return (int) (this.data & -1L);
|
||||
}
|
||||
|
||||
public short getShort() {
|
||||
return (short) ((int) (this.data & 65535L));
|
||||
}
|
||||
|
||||
public byte getByte() {
|
||||
return (byte) ((int) (this.data & 255L));
|
||||
}
|
||||
|
||||
public double getDouble() {
|
||||
return (double) this.data;
|
||||
}
|
||||
|
||||
public float getFloat() {
|
||||
return (float) this.data;
|
||||
}
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
package net.minecraft.nbt;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class NBTTagShort extends NBTBase.NBTPrimitive {
|
||||
private short data;
|
||||
|
||||
public NBTTagShort() {
|
||||
}
|
||||
|
||||
public NBTTagShort(short data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Write the actual data contents of the tag, implemented in NBT
|
||||
* extension classes
|
||||
*/
|
||||
void write(DataOutput parDataOutput) throws IOException {
|
||||
parDataOutput.writeShort(this.data);
|
||||
}
|
||||
|
||||
void read(DataInput parDataInput, int parInt1, NBTSizeTracker parNBTSizeTracker) throws IOException {
|
||||
parNBTSizeTracker.read(80L);
|
||||
this.data = parDataInput.readShort();
|
||||
}
|
||||
|
||||
/**+
|
||||
* Gets the type byte for the tag.
|
||||
*/
|
||||
public byte getId() {
|
||||
return (byte) 2;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "" + this.data + "s";
|
||||
}
|
||||
|
||||
/**+
|
||||
* Creates a clone of the tag.
|
||||
*/
|
||||
public NBTBase copy() {
|
||||
return new NBTTagShort(this.data);
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (super.equals(object)) {
|
||||
NBTTagShort nbttagshort = (NBTTagShort) object;
|
||||
return this.data == nbttagshort.data;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return super.hashCode() ^ this.data;
|
||||
}
|
||||
|
||||
public long getLong() {
|
||||
return (long) this.data;
|
||||
}
|
||||
|
||||
public int getInt() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
public short getShort() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
public byte getByte() {
|
||||
return (byte) (this.data & 255);
|
||||
}
|
||||
|
||||
public double getDouble() {
|
||||
return (double) this.data;
|
||||
}
|
||||
|
||||
public float getFloat() {
|
||||
return (float) this.data;
|
||||
}
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
package net.minecraft.nbt;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class NBTTagString extends NBTBase {
|
||||
private String data;
|
||||
|
||||
public NBTTagString() {
|
||||
this.data = "";
|
||||
}
|
||||
|
||||
public NBTTagString(String data) {
|
||||
this.data = data;
|
||||
if (data == null) {
|
||||
throw new IllegalArgumentException("Empty string not allowed");
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Write the actual data contents of the tag, implemented in NBT
|
||||
* extension classes
|
||||
*/
|
||||
void write(DataOutput parDataOutput) throws IOException {
|
||||
parDataOutput.writeUTF(this.data);
|
||||
}
|
||||
|
||||
void read(DataInput parDataInput, int parInt1, NBTSizeTracker parNBTSizeTracker) throws IOException {
|
||||
parNBTSizeTracker.read(288L);
|
||||
this.data = parDataInput.readUTF();
|
||||
parNBTSizeTracker.read((long) (16 * this.data.length()));
|
||||
}
|
||||
|
||||
/**+
|
||||
* Gets the type byte for the tag.
|
||||
*/
|
||||
public byte getId() {
|
||||
return (byte) 8;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "\"" + this.data.replace("\"", "\\\"") + "\"";
|
||||
}
|
||||
|
||||
/**+
|
||||
* Creates a clone of the tag.
|
||||
*/
|
||||
public NBTBase copy() {
|
||||
return new NBTTagString(this.data);
|
||||
}
|
||||
|
||||
/**+
|
||||
* Return whether this compound has no tags.
|
||||
*/
|
||||
public boolean hasNoTags() {
|
||||
return this.data.isEmpty();
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (!super.equals(object)) {
|
||||
return false;
|
||||
} else {
|
||||
NBTTagString nbttagstring = (NBTTagString) object;
|
||||
return this.data == null && nbttagstring.data == null
|
||||
|| this.data != null && this.data.equals(nbttagstring.data);
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return super.hashCode() ^ this.data.hashCode();
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return this.data;
|
||||
}
|
||||
}
|
||||
Executable
+167
@@ -0,0 +1,167 @@
|
||||
package net.minecraft.nbt;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.MultimapBuilder;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.mojang.authlib.GameProfile;
|
||||
import net.lax1dude.eaglercraft.v1_8.mojang.authlib.Property;
|
||||
import net.minecraft.util.StringUtils;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public final class NBTUtil {
|
||||
/**+
|
||||
* Reads and returns a GameProfile that has been saved to the
|
||||
* passed in NBTTagCompound
|
||||
*/
|
||||
public static GameProfile readGameProfileFromNBT(NBTTagCompound compound) {
|
||||
String s = null;
|
||||
String s1 = null;
|
||||
if (compound.hasKey("Name", 8)) {
|
||||
s = compound.getString("Name");
|
||||
}
|
||||
|
||||
if (compound.hasKey("Id", 8)) {
|
||||
s1 = compound.getString("Id");
|
||||
}
|
||||
|
||||
if (StringUtils.isNullOrEmpty(s) && StringUtils.isNullOrEmpty(s1)) {
|
||||
return null;
|
||||
} else {
|
||||
EaglercraftUUID uuid;
|
||||
try {
|
||||
uuid = EaglercraftUUID.fromString(s1);
|
||||
} catch (Throwable var12) {
|
||||
uuid = null;
|
||||
}
|
||||
|
||||
Multimap<String, Property> propertiesMap = MultimapBuilder.hashKeys().arrayListValues().build();
|
||||
if (compound.hasKey("Properties", 10)) {
|
||||
NBTTagCompound nbttagcompound = compound.getCompoundTag("Properties");
|
||||
for (String s2 : nbttagcompound.getKeySet()) {
|
||||
NBTTagList nbttaglist = nbttagcompound.getTagList(s2, 10);
|
||||
for (int i = 0, l = nbttaglist.tagCount(); i < l; ++i) {
|
||||
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
|
||||
String value = nbttagcompound1.getString("Value");
|
||||
if (!StringUtils.isNullOrEmpty(value)) {
|
||||
String sig = nbttagcompound1.getString("Signature");
|
||||
if (!StringUtils.isNullOrEmpty(sig)) {
|
||||
propertiesMap.put(s2, new Property(s2, value, sig));
|
||||
} else {
|
||||
propertiesMap.put(s2, new Property(s2, value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new GameProfile(uuid, s, propertiesMap);
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Writes a GameProfile to an NBTTagCompound.
|
||||
*/
|
||||
public static NBTTagCompound writeGameProfile(NBTTagCompound tagCompound, GameProfile profile) {
|
||||
if (!StringUtils.isNullOrEmpty(profile.getName())) {
|
||||
tagCompound.setString("Name", profile.getName());
|
||||
}
|
||||
|
||||
if (profile.getId() != null) {
|
||||
tagCompound.setString("Id", profile.getId().toString());
|
||||
}
|
||||
|
||||
Multimap<String, Property> propertiesMap = profile.getProperties();
|
||||
if (!propertiesMap.isEmpty()) {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
for (String s : profile.getProperties().keySet()) {
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (Property property : profile.getProperties().get(s)) {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
nbttagcompound1.setString("Value", property.getValue());
|
||||
if (property.hasSignature()) {
|
||||
nbttagcompound1.setString("Signature", property.getSignature());
|
||||
}
|
||||
|
||||
nbttaglist.appendTag(nbttagcompound1);
|
||||
}
|
||||
|
||||
nbttagcompound.setTag(s, nbttaglist);
|
||||
}
|
||||
tagCompound.setTag("Properties", nbttagcompound);
|
||||
}
|
||||
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
public static boolean func_181123_a(NBTBase parNBTBase, NBTBase parNBTBase2, boolean parFlag) {
|
||||
if (parNBTBase == parNBTBase2) {
|
||||
return true;
|
||||
} else if (parNBTBase == null) {
|
||||
return true;
|
||||
} else if (parNBTBase2 == null) {
|
||||
return false;
|
||||
} else if (!parNBTBase.getClass().equals(parNBTBase2.getClass())) {
|
||||
return false;
|
||||
} else if (parNBTBase instanceof NBTTagCompound) {
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) parNBTBase;
|
||||
NBTTagCompound nbttagcompound1 = (NBTTagCompound) parNBTBase2;
|
||||
|
||||
for (String s : nbttagcompound.getKeySet()) {
|
||||
NBTBase nbtbase1 = nbttagcompound.getTag(s);
|
||||
if (!func_181123_a(nbtbase1, nbttagcompound1.getTag(s), parFlag)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (parNBTBase instanceof NBTTagList && parFlag) {
|
||||
NBTTagList nbttaglist = (NBTTagList) parNBTBase;
|
||||
NBTTagList nbttaglist1 = (NBTTagList) parNBTBase2;
|
||||
if (nbttaglist.tagCount() == 0) {
|
||||
return nbttaglist1.tagCount() == 0;
|
||||
} else {
|
||||
for (int i = 0; i < nbttaglist.tagCount(); ++i) {
|
||||
NBTBase nbtbase = nbttaglist.get(i);
|
||||
boolean flag = false;
|
||||
|
||||
for (int j = 0; j < nbttaglist1.tagCount(); ++j) {
|
||||
if (func_181123_a(nbtbase, nbttaglist1.get(j), parFlag)) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return parNBTBase.equals(parNBTBase2);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user