mirror of
https://github.com/GTNewHorizons/CodeChickenCore.git
synced 2026-11-16 18:54:51 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f02dbc956c | ||
|
|
63f36ca383 | ||
|
|
bb008a1265 |
No files matched your search
@@ -27,3 +27,4 @@ whitelist.json
|
|||||||
*.iws
|
*.iws
|
||||||
src/main/resources/mixins.*.json
|
src/main/resources/mixins.*.json
|
||||||
*.bat
|
*.bat
|
||||||
|
.DS_Store
|
||||||
+39
-4
@@ -39,9 +39,33 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co
|
|||||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||||
developmentEnvironmentUserName = Developer
|
developmentEnvironmentUserName = Developer
|
||||||
|
|
||||||
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
# Enables modern Java syntax support. Valid values:
|
||||||
# See https://github.com/bsideup/jabel for details on how this works.
|
# - false: No modern syntax, Java 8 only
|
||||||
enableModernJavaSyntax = true
|
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
|
||||||
|
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
|
||||||
|
# - modern: Native modern Java bytecode, no downgrading
|
||||||
|
enableModernJavaSyntax = jabel
|
||||||
|
|
||||||
|
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
|
||||||
|
# and should *not* be used in most situations. -1 disables this.
|
||||||
|
# forceToolchainVersion = -1
|
||||||
|
|
||||||
|
# Target JVM version for JVM Downgrader bytecode downgrading.
|
||||||
|
# Only used when enableModernJavaSyntax = jvmDowngrader
|
||||||
|
# downgradeTargetVersion = 8
|
||||||
|
|
||||||
|
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
|
||||||
|
# Classes will be available in META-INF/versions/N/ for each version N in this list.
|
||||||
|
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
|
||||||
|
# jvmDowngraderMultiReleaseVersions = 21,25
|
||||||
|
|
||||||
|
# Specifies how JVM Downgrader API stubs are provided. Options:
|
||||||
|
# - shade: Shade minimized stubs into the jar
|
||||||
|
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
|
||||||
|
# - external: Another dependency provides stubs (no constraint, no warning)
|
||||||
|
# - (empty): Warning reminding you to configure stubs
|
||||||
|
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
|
||||||
|
# jvmDowngraderStubsProvider =
|
||||||
|
|
||||||
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||||
@@ -90,7 +114,9 @@ usesMixinDebug = false
|
|||||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||||
mixinPlugin =
|
mixinPlugin =
|
||||||
|
|
||||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
# Specify the package that contains all of your Mixins. The package must exist or
|
||||||
|
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
|
||||||
|
# it must match with this or the build will fail.
|
||||||
mixinsPackage =
|
mixinsPackage =
|
||||||
|
|
||||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||||
@@ -166,6 +192,12 @@ curseForgeRelations =
|
|||||||
# projects. New projects should not use this parameter.
|
# projects. New projects should not use this parameter.
|
||||||
# customArchiveBaseName =
|
# customArchiveBaseName =
|
||||||
|
|
||||||
|
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
|
||||||
|
# runClientWorkingDirectory = run/client
|
||||||
|
|
||||||
|
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
|
||||||
|
# runServerWorkingDirectory = run/server
|
||||||
|
|
||||||
# Optional parameter to have the build automatically fail if an illegal version is used.
|
# Optional parameter to have the build automatically fail if an illegal version is used.
|
||||||
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
|
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
|
||||||
# The check is ONLY performed if the version is a git tag.
|
# The check is ONLY performed if the version is a git tag.
|
||||||
@@ -195,3 +227,6 @@ curseForgeRelations =
|
|||||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||||
# ideaCheckSpotlessOnBuild = true
|
# ideaCheckSpotlessOnBuild = true
|
||||||
|
|
||||||
|
# Non-GTNH properties
|
||||||
|
org.gradle.configuration-cache = true
|
||||||
|
org.gradle.parallel = true
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#This file is generated by updateDaemonJvm
|
||||||
|
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
|
||||||
|
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/b41931cf1e70bc8e08d7dd19c343ef00/redirect
|
||||||
|
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
|
||||||
|
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/b41931cf1e70bc8e08d7dd19c343ef00/redirect
|
||||||
|
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/46949723aaa20c7b64d7ecfed7207034/redirect
|
||||||
|
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/f636c800fdb3f9ae33f019dfa048ba72/redirect
|
||||||
|
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
|
||||||
|
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/b41931cf1e70bc8e08d7dd19c343ef00/redirect
|
||||||
|
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1e91f45234d88a64dafb961c93ddc75a/redirect
|
||||||
|
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/552c7bffe0370c66410a51c55985b511/redirect
|
||||||
|
toolchainVersion=25
|
||||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright © 2015-2021 the original authors.
|
# Copyright © 2015 the original authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -114,7 +114,6 @@ case "$( uname )" in #(
|
|||||||
NONSTOP* ) nonstop=true ;;
|
NONSTOP* ) nonstop=true ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
@@ -172,7 +171,6 @@ fi
|
|||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if "$cygwin" || "$msys" ; then
|
if "$cygwin" || "$msys" ; then
|
||||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
|
||||||
|
|
||||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
@@ -212,8 +210,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
-classpath "$CLASSPATH" \
|
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||||
org.gradle.wrapper.GradleWrapperMain \
|
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
# Stop when "xargs" is not available.
|
# Stop when "xargs" is not available.
|
||||||
|
|||||||
Vendored
+1
-2
@@ -70,11 +70,10 @@ goto fail
|
|||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.41'
|
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.21'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,14 +1,12 @@
|
|||||||
package codechicken.lib.asm;
|
package codechicken.lib.asm;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.Map;
|
||||||
import java.util.HashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
import net.minecraft.launchwrapper.IClassTransformer;
|
import net.minecraft.launchwrapper.IClassTransformer;
|
||||||
import net.minecraft.launchwrapper.Launch;
|
import net.minecraft.launchwrapper.Launch;
|
||||||
import net.minecraft.launchwrapper.LaunchClassLoader;
|
|
||||||
|
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.ClassReader;
|
||||||
|
|
||||||
import cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
|
import cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
|
||||||
|
|
||||||
@@ -18,43 +16,60 @@ import cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
|
|||||||
*/
|
*/
|
||||||
public class ClassHeirachyManager implements IClassTransformer {
|
public class ClassHeirachyManager implements IClassTransformer {
|
||||||
|
|
||||||
public static class SuperCache {
|
private static final Map<String, ClassInfo> superclasses = new ConcurrentHashMap<>(1000);
|
||||||
|
|
||||||
String superclass;
|
static {
|
||||||
public HashSet<String> parents = new HashSet<String>();
|
superclasses.put("java.lang.Object", ClassInfo.OBJECT);
|
||||||
private boolean flattened;
|
}
|
||||||
|
|
||||||
public void add(String parent) {
|
@Override
|
||||||
parents.add(parent);
|
public byte[] transform(String name, String transformedName, byte[] bytes) {
|
||||||
|
if (bytes == null) return null;
|
||||||
|
if (!superclasses.containsKey(transformedName)) {
|
||||||
|
declareASM(transformedName, bytes);
|
||||||
}
|
}
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
|
||||||
public void flatten() {
|
private static ClassInfo declareASM(String name, byte[] bytes) {
|
||||||
if (flattened) return;
|
final ClassReader classReader = new ClassReader(bytes);
|
||||||
|
final ClassInfo classInfo = new ClassInfo(classReader);
|
||||||
|
superclasses.put(name, classInfo);
|
||||||
|
return classInfo;
|
||||||
|
}
|
||||||
|
|
||||||
for (String s : new ArrayList<String>(parents)) {
|
private static ClassInfo declareReflection(String name) throws ClassNotFoundException {
|
||||||
SuperCache c = declareClass(s);
|
final Class<?> aclass = Class.forName(name);
|
||||||
if (c != null) {
|
final ClassInfo classInfo = new ClassInfo(aclass);
|
||||||
c.flatten();
|
superclasses.put(name, classInfo);
|
||||||
parents.addAll(c.parents);
|
return classInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static ClassInfo declareClass(String name) {
|
||||||
|
try {
|
||||||
|
byte[] bytes = Launch.classLoader.getClassBytes(unKey(name));
|
||||||
|
if (bytes != null) {
|
||||||
|
return declareASM(name, bytes);
|
||||||
}
|
}
|
||||||
flattened = true;
|
} catch (Exception ignored) {}
|
||||||
|
try {
|
||||||
|
return declareReflection(name);
|
||||||
|
} catch (ClassNotFoundException ignored) {}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String toKey(String name) {
|
||||||
|
if (ObfMapping.obfuscated) {
|
||||||
|
return FMLDeobfuscatingRemapper.INSTANCE.map(name.replace('.', '/')).replace('/', '.');
|
||||||
}
|
}
|
||||||
|
return name.replace('/', '.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<String, SuperCache> superclasses = new HashMap<String, SuperCache>();
|
private static String unKey(String name) {
|
||||||
private static LaunchClassLoader cl = Launch.classLoader;
|
if (ObfMapping.obfuscated) {
|
||||||
|
return FMLDeobfuscatingRemapper.INSTANCE.unmap(name.replace('.', '/')).replace('/', '.');
|
||||||
public static String toKey(String name) {
|
}
|
||||||
if (ObfMapping.obfuscated)
|
return name.replace('/', '.');
|
||||||
name = FMLDeobfuscatingRemapper.INSTANCE.map(name.replace('.', '/')).replace('/', '.');
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String unKey(String name) {
|
|
||||||
if (ObfMapping.obfuscated)
|
|
||||||
name = FMLDeobfuscatingRemapper.INSTANCE.unmap(name.replace('.', '/')).replace('/', '.');
|
|
||||||
return name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,83 +83,94 @@ public class ClassHeirachyManager implements IClassTransformer {
|
|||||||
|
|
||||||
if (name.equals(superclass)) return true;
|
if (name.equals(superclass)) return true;
|
||||||
|
|
||||||
SuperCache cache = declareClass(name);
|
ClassInfo classInfo = superclasses.get(name);
|
||||||
if (cache == null) // just can't handle this
|
if (classInfo == null) classInfo = declareClass(name);
|
||||||
return false;
|
if (classInfo == null) return false;
|
||||||
|
|
||||||
cache.flatten();
|
return classInfo.hasSuper(superclass);
|
||||||
return cache.parents.contains(superclass);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static SuperCache declareClass(String name) {
|
|
||||||
name = toKey(name);
|
|
||||||
SuperCache cache = superclasses.get(name);
|
|
||||||
|
|
||||||
if (cache != null) return cache;
|
|
||||||
|
|
||||||
try {
|
|
||||||
byte[] bytes = cl.getClassBytes(unKey(name));
|
|
||||||
if (bytes != null) cache = declareASM(bytes);
|
|
||||||
} catch (Exception e) {}
|
|
||||||
|
|
||||||
if (cache != null) return cache;
|
|
||||||
|
|
||||||
try {
|
|
||||||
cache = declareReflection(name);
|
|
||||||
} catch (ClassNotFoundException e) {}
|
|
||||||
|
|
||||||
return cache;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static SuperCache declareReflection(String name) throws ClassNotFoundException {
|
|
||||||
Class<?> aclass = Class.forName(name);
|
|
||||||
|
|
||||||
SuperCache cache = getOrCreateCache(name);
|
|
||||||
if (aclass.isInterface()) cache.superclass = "java.lang.Object";
|
|
||||||
else if (name.equals("java.lang.Object")) return cache;
|
|
||||||
else cache.superclass = toKey(aclass.getSuperclass().getName());
|
|
||||||
|
|
||||||
cache.add(cache.superclass);
|
|
||||||
for (Class<?> iclass : aclass.getInterfaces()) cache.add(toKey(iclass.getName()));
|
|
||||||
|
|
||||||
return cache;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static SuperCache declareASM(byte[] bytes) {
|
|
||||||
ClassNode node = ASMHelper.createClassNode(bytes);
|
|
||||||
String name = toKey(node.name);
|
|
||||||
|
|
||||||
SuperCache cache = getOrCreateCache(name);
|
|
||||||
cache.superclass = toKey(node.superName.replace('/', '.'));
|
|
||||||
cache.add(cache.superclass);
|
|
||||||
for (String iclass : node.interfaces) cache.add(toKey(iclass.replace('/', '.')));
|
|
||||||
|
|
||||||
return cache;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte[] transform(String name, String tname, byte[] bytes) {
|
|
||||||
if (bytes == null) return null;
|
|
||||||
|
|
||||||
if (!superclasses.containsKey(tname)) declareASM(bytes);
|
|
||||||
|
|
||||||
return bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SuperCache getOrCreateCache(String name) {
|
|
||||||
SuperCache cache = superclasses.get(name);
|
|
||||||
if (cache == null) superclasses.put(name, cache = new SuperCache());
|
|
||||||
return cache;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getSuperClass(String name, boolean runtime) {
|
public static String getSuperClass(String name, boolean runtime) {
|
||||||
name = toKey(name);
|
name = toKey(name);
|
||||||
SuperCache cache = declareClass(name);
|
|
||||||
if (cache == null) return "java.lang.Object";
|
|
||||||
|
|
||||||
cache.flatten();
|
ClassInfo classInfo = superclasses.get(name);
|
||||||
String s = cache.superclass;
|
if (classInfo == null) classInfo = declareClass(name);
|
||||||
if (!runtime) s = FMLDeobfuscatingRemapper.INSTANCE.unmap(s);
|
if (classInfo == null || classInfo.superclass == null) return "java.lang.Object";
|
||||||
|
|
||||||
|
final String s = classInfo.superclass;
|
||||||
|
if (!runtime) {
|
||||||
|
return FMLDeobfuscatingRemapper.INSTANCE.unmap(s);
|
||||||
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class ClassInfo {
|
||||||
|
|
||||||
|
public static final ClassInfo OBJECT = new ClassInfo();
|
||||||
|
|
||||||
|
public final String superclass;
|
||||||
|
public final String[] interfaces;
|
||||||
|
public ClassInfo parent;
|
||||||
|
|
||||||
|
private ClassInfo() {
|
||||||
|
this.superclass = null;
|
||||||
|
this.interfaces = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClassInfo(ClassReader classReader) {
|
||||||
|
final String superName = classReader.getSuperName();
|
||||||
|
final String[] interfaces = classReader.getInterfaces();
|
||||||
|
|
||||||
|
if (superName == null || "java/lang/Object".equals(superName)) {
|
||||||
|
superclass = "java.lang.Object";
|
||||||
|
parent = OBJECT;
|
||||||
|
} else {
|
||||||
|
superclass = toKey(superName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (interfaces == null || interfaces.length == 0) {
|
||||||
|
this.interfaces = null;
|
||||||
|
} else {
|
||||||
|
this.interfaces = new String[interfaces.length];
|
||||||
|
for (int i = 0; i < interfaces.length; i++) {
|
||||||
|
this.interfaces[i] = toKey(interfaces[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClassInfo(Class<?> aclass) {
|
||||||
|
if (aclass.isInterface()) {
|
||||||
|
this.superclass = "java.lang.Object";
|
||||||
|
this.parent = OBJECT;
|
||||||
|
} else {
|
||||||
|
final Class<?> superclass = aclass.getSuperclass();
|
||||||
|
if (superclass == null || "java.lang.Object".equals(superclass.getName())) {
|
||||||
|
this.superclass = "java.lang.Object";
|
||||||
|
this.parent = OBJECT;
|
||||||
|
} else {
|
||||||
|
this.superclass = toKey(superclass.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final Class<?>[] interfaces = aclass.getInterfaces();
|
||||||
|
if (interfaces.length == 0) {
|
||||||
|
this.interfaces = null;
|
||||||
|
} else {
|
||||||
|
this.interfaces = new String[interfaces.length];
|
||||||
|
for (int i = 0; i < interfaces.length; i++) {
|
||||||
|
this.interfaces[i] = toKey(interfaces[i].getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasSuper(String superclass) {
|
||||||
|
if (this.superclass == null) return false;
|
||||||
|
if (this.superclass.equals(superclass)) return true;
|
||||||
|
ClassInfo parentInfo = this.parent;
|
||||||
|
if (parentInfo == null) parentInfo = superclasses.get(this.superclass);
|
||||||
|
if (parentInfo == null) parentInfo = declareClass(this.superclass);
|
||||||
|
if (parentInfo == null) return false;
|
||||||
|
this.parent = parentInfo;
|
||||||
|
return parentInfo.hasSuper(superclass);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -351,9 +351,9 @@ public final class PacketCustom implements MCDataInput, MCDataOutput {
|
|||||||
|
|
||||||
public PacketCustom writeItemStack(ItemStack stack, boolean large) {
|
public PacketCustom writeItemStack(ItemStack stack, boolean large) {
|
||||||
if (stack == null) {
|
if (stack == null) {
|
||||||
writeShort(-1);
|
writeInt(-1);
|
||||||
} else {
|
} else {
|
||||||
writeShort(Item.getIdFromItem(stack.getItem()));
|
writeInt(Item.getIdFromItem(stack.getItem()));
|
||||||
if (large) writeInt(stack.stackSize);
|
if (large) writeInt(stack.stackSize);
|
||||||
else writeByte(stack.stackSize);
|
else writeByte(stack.stackSize);
|
||||||
writeShort(stack.getItemDamage());
|
writeShort(stack.getItemDamage());
|
||||||
@@ -448,7 +448,7 @@ public final class PacketCustom implements MCDataInput, MCDataOutput {
|
|||||||
|
|
||||||
public ItemStack readItemStack(boolean large) {
|
public ItemStack readItemStack(boolean large) {
|
||||||
ItemStack item = null;
|
ItemStack item = null;
|
||||||
short itemID = readShort();
|
int itemID = readInt();
|
||||||
|
|
||||||
if (itemID >= 0) {
|
if (itemID >= 0) {
|
||||||
int stackSize = large ? readInt() : readByte();
|
int stackSize = large ? readInt() : readByte();
|
||||||
|
|||||||
Reference in new issue
Block a user