-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #140 from juanmuscaria/newJava
Support for newer java versions by integrating lwjgl3ify directly
- Loading branch information
Showing
65 changed files
with
2,229 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--illegal-access=warn | ||
-Djava.security.manager=allow | ||
-Dfile.encoding=UTF-8 | ||
-Dcrucible.weAreJava9=true | ||
--add-opens | ||
java.base/jdk.internal.loader=ALL-UNNAMED | ||
--add-opens | ||
java.base/java.net=ALL-UNNAMED | ||
--add-opens | ||
java.base/java.nio=ALL-UNNAMED | ||
--add-opens | ||
java.base/java.io=ALL-UNNAMED | ||
--add-opens | ||
java.base/java.lang=ALL-UNNAMED | ||
--add-opens | ||
java.base/java.lang.reflect=ALL-UNNAMED | ||
--add-opens | ||
java.base/java.text=ALL-UNNAMED | ||
--add-opens | ||
java.base/java.util=ALL-UNNAMED | ||
--add-opens | ||
java.base/jdk.internal.reflect=ALL-UNNAMED | ||
--add-opens | ||
java.base/sun.nio.ch=ALL-UNNAMED | ||
--add-opens | ||
jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED,java.naming | ||
--add-opens | ||
java.desktop/sun.awt.image=ALL-UNNAMED | ||
--add-opens | ||
java.desktop/com.sun.imageio.plugins.png=ALL-UNNAMED | ||
--add-modules jdk.dynalink | ||
--add-opens | ||
jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED | ||
--add-modules java.sql.rowset | ||
--add-opens | ||
java.sql.rowset/javax.sql.rowset.serial=ALL-UNNAMED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- ../src-base/minecraft/cpw/mods/fml/common/TracingPrintStream.java | ||
+++ ../src-work/minecraft/cpw/mods/fml/common/TracingPrintStream.java | ||
@@ -47,4 +47,10 @@ | ||
return "[" + elem.getClassName() + ":" + elem.getMethodName() + ":" + elem.getLineNumber() + "]: "; | ||
} | ||
|
||
+ @Override | ||
+ public void close() { | ||
+ // no-op | ||
+ //println("Something tried to close the main output stream"); | ||
+ //new Throwable().printStackTrace(); | ||
+ } | ||
} |
20 changes: 20 additions & 0 deletions
20
patches/cpw/mods/fml/common/asm/transformers/EventSubscriptionTransformer.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- ../src-base/minecraft/cpw/mods/fml/common/asm/transformers/EventSubscriptionTransformer.java | ||
+++ ../src-work/minecraft/cpw/mods/fml/common/asm/transformers/EventSubscriptionTransformer.java | ||
@@ -123,7 +123,7 @@ | ||
{ | ||
for (AnnotationNode node : classNode.visibleAnnotations) | ||
{ | ||
- if (!hasResult && node.desc.equals("Lcpw/mods/fml/common/eventhandler/Event$HasResult;")) | ||
+ if (!hasResult && node.desc.replace('$', '/').equals("Lcpw/mods/fml/common/eventhandler/Event/HasResult;")) | ||
{ | ||
/* Add: | ||
* public boolean hasResult() | ||
@@ -162,7 +162,7 @@ | ||
return edited; | ||
} | ||
|
||
- Type tSuper = Type.getType(classNode.superName); | ||
+ Type tSuper = Type.getObjectType(classNode.superName); | ||
|
||
//Add private static ListenerList LISTENER_LIST | ||
classNode.fields.add(new FieldNode(ACC_PRIVATE | ACC_STATIC, "LISTENER_LIST", listDesc, null, null)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
patches/cpw/mods/fml/common/discovery/asm/ModAnnotationVisitor.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- ../src-base/minecraft/cpw/mods/fml/common/discovery/asm/ModAnnotationVisitor.java | ||
+++ ../src-work/minecraft/cpw/mods/fml/common/discovery/asm/ModAnnotationVisitor.java | ||
@@ -25,7 +25,7 @@ | ||
|
||
public ModAnnotationVisitor(ASMModParser discoverer) | ||
{ | ||
- super(Opcodes.ASM5); | ||
+ super(Opcodes.ASM9); | ||
this.discoverer = discoverer; | ||
} | ||
|
11 changes: 11 additions & 0 deletions
11
patches/cpw/mods/fml/common/discovery/asm/ModClassVisitor.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- ../src-base/minecraft/cpw/mods/fml/common/discovery/asm/ModClassVisitor.java | ||
+++ ../src-work/minecraft/cpw/mods/fml/common/discovery/asm/ModClassVisitor.java | ||
@@ -24,7 +24,7 @@ | ||
|
||
public ModClassVisitor(ASMModParser discoverer) | ||
{ | ||
- super(Opcodes.ASM5); | ||
+ super(Opcodes.ASM9); | ||
this.discoverer = discoverer; | ||
} | ||
|
11 changes: 11 additions & 0 deletions
11
patches/cpw/mods/fml/common/discovery/asm/ModFieldVisitor.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- ../src-base/minecraft/cpw/mods/fml/common/discovery/asm/ModFieldVisitor.java | ||
+++ ../src-work/minecraft/cpw/mods/fml/common/discovery/asm/ModFieldVisitor.java | ||
@@ -24,7 +24,7 @@ | ||
|
||
public ModFieldVisitor(String name, ASMModParser discoverer) | ||
{ | ||
- super(Opcodes.ASM5); | ||
+ super(Opcodes.ASM9); | ||
this.fieldName = name; | ||
this.discoverer = discoverer; | ||
} |
11 changes: 11 additions & 0 deletions
11
patches/cpw/mods/fml/common/discovery/asm/ModMethodVisitor.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- ../src-base/minecraft/cpw/mods/fml/common/discovery/asm/ModMethodVisitor.java | ||
+++ ../src-work/minecraft/cpw/mods/fml/common/discovery/asm/ModMethodVisitor.java | ||
@@ -12,7 +12,7 @@ | ||
|
||
public ModMethodVisitor(String name, String desc, ASMModParser discoverer) | ||
{ | ||
- super(Opcodes.ASM5); | ||
+ super(Opcodes.ASM9); | ||
this.methodName = name; | ||
this.methodDescriptor = desc; | ||
this.discoverer = discoverer; |
10 changes: 0 additions & 10 deletions
10
patches/cpw/mods/fml/common/launcher/FMLServerTweaker.java.patch
This file was deleted.
Oops, something went wrong.
54 changes: 54 additions & 0 deletions
54
patches/cpw/mods/fml/common/patcher/ClassPatchManager.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- ../src-base/minecraft/cpw/mods/fml/common/patcher/ClassPatchManager.java | ||
+++ ../src-work/minecraft/cpw/mods/fml/common/patcher/ClassPatchManager.java | ||
@@ -14,11 +14,13 @@ | ||
import java.util.jar.Pack200; | ||
import java.util.regex.Pattern; | ||
|
||
+import org.apache.commons.compress.harmony.unpack200.Archive; | ||
import org.apache.logging.log4j.Level; | ||
|
||
import net.minecraft.launchwrapper.LaunchClassLoader; | ||
|
||
-import LZMA.LzmaInputStream; | ||
+import org.apache.commons.compress.harmony.unpack200.Pack200UnpackerAdapter; | ||
+import org.apache.logging.log4j.Level; | ||
|
||
import com.google.common.base.Joiner; | ||
import com.google.common.base.Throwables; | ||
@@ -30,11 +32,13 @@ | ||
import com.google.common.io.ByteStreams; | ||
import com.google.common.io.Files; | ||
|
||
+import LZMA.LzmaInputStream; | ||
import cpw.mods.fml.relauncher.FMLRelaunchLog; | ||
import cpw.mods.fml.relauncher.Side; | ||
import cpw.mods.fml.repackage.com.nothome.delta.GDiffPatcher; | ||
|
||
public class ClassPatchManager { | ||
+ | ||
public static final ClassPatchManager INSTANCE = new ClassPatchManager(); | ||
|
||
public static final boolean dumpPatched = Boolean.parseBoolean(System.getProperty("fml.dumpPatchedClasses", "false")); | ||
@@ -155,10 +159,20 @@ | ||
FMLRelaunchLog.log(Level.ERROR, "The binary patch set is missing. Either you are in a development environment, or things are not going to work!"); | ||
return; | ||
} | ||
- LzmaInputStream binpatchesDecompressed = new LzmaInputStream(binpatchesCompressed); | ||
+ // Crucible start - apply lwjgl3ify patch | ||
+ // LzmaInputStream binpatchesDecompressed = new LzmaInputStream(binpatchesCompressed); | ||
+ LzmaInputStream binpatchesDecompressedLzma = new LzmaInputStream(binpatchesCompressed); | ||
+ // The Apache pack200 stream chokes on a lzmainputstream for some reason | ||
+ byte[] decompressed = ByteStreams.toByteArray(binpatchesDecompressedLzma); | ||
+ binpatchesDecompressedLzma.close(); | ||
+ ByteArrayInputStream binpatchesDecompressed = new ByteArrayInputStream(decompressed); | ||
ByteArrayOutputStream jarBytes = new ByteArrayOutputStream(); | ||
JarOutputStream jos = new JarOutputStream(jarBytes); | ||
- Pack200.newUnpacker().unpack(binpatchesDecompressed, jos); | ||
+ | ||
+ //Pack200.newUnpacker().unpack(binpatchesDecompressed, jos); | ||
+ new Pack200UnpackerAdapter().unpack(binpatchesDecompressed, jos); | ||
+ // Crucible end | ||
+ | ||
jis = new JarInputStream(new ByteArrayInputStream(jarBytes.toByteArray())); | ||
} | ||
catch (Exception e) |
114 changes: 114 additions & 0 deletions
114
patches/cpw/mods/fml/common/registry/ItemStackHolderRef.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
--- ../src-base/minecraft/cpw/mods/fml/common/registry/ItemStackHolderRef.java | ||
+++ ../src-work/minecraft/cpw/mods/fml/common/registry/ItemStackHolderRef.java | ||
@@ -1,5 +1,7 @@ | ||
package cpw.mods.fml.common.registry; | ||
|
||
+import java.lang.invoke.MethodHandle; | ||
+import java.lang.invoke.MethodHandles; | ||
import java.lang.reflect.Field; | ||
import java.lang.reflect.Method; | ||
import java.lang.reflect.Modifier; | ||
@@ -40,20 +42,26 @@ | ||
private static Object reflectionFactory; | ||
private static Method newFieldAccessor; | ||
private static Method fieldAccessorSet; | ||
+ private static MethodHandle fieldSetter; // Crucible - lwjgl3ify field | ||
private static void makeWritable(Field f) | ||
{ | ||
try | ||
{ | ||
- if (modifiersField == null) | ||
- { | ||
- Method getReflectionFactory = Class.forName("sun.reflect.ReflectionFactory").getDeclaredMethod("getReflectionFactory"); | ||
- reflectionFactory = getReflectionFactory.invoke(null); | ||
- newFieldAccessor = Class.forName("sun.reflect.ReflectionFactory").getDeclaredMethod("newFieldAccessor", Field.class, boolean.class); | ||
- fieldAccessorSet = Class.forName("sun.reflect.FieldAccessor").getDeclaredMethod("set", Object.class, Object.class); | ||
- modifiersField = Field.class.getDeclaredField("modifiers"); | ||
- modifiersField.setAccessible(true); | ||
- } | ||
- modifiersField.setInt(f, f.getModifiers() & ~Modifier.FINAL); | ||
+ // Crucible start - implement lwjgl3ify patch directly | ||
+// if (modifiersField == null) | ||
+// { | ||
+// Method getReflectionFactory = Class.forName("sun.reflect.ReflectionFactory").getDeclaredMethod("getReflectionFactory"); | ||
+// reflectionFactory = getReflectionFactory.invoke(null); | ||
+// newFieldAccessor = Class.forName("sun.reflect.ReflectionFactory").getDeclaredMethod("newFieldAccessor", Field.class, boolean.class); | ||
+// fieldAccessorSet = Class.forName("sun.reflect.FieldAccessor").getDeclaredMethod("set", Object.class, Object.class); | ||
+// modifiersField = Field.class.getDeclaredField("modifiers"); | ||
+// modifiersField.setAccessible(true); | ||
+// } | ||
+// modifiersField.setInt(f, f.getModifiers() & ~Modifier.FINAL); | ||
+ f.setAccessible(true); | ||
+ fieldSetter = MethodHandles.lookup() | ||
+ .unreflectSetter(f); | ||
+ // Crucible end | ||
} catch (Exception e) | ||
{ | ||
throw Throwables.propagate(e); | ||
@@ -62,23 +70,53 @@ | ||
|
||
public void apply() | ||
{ | ||
+ // Crucible start - implement lwjgl3ify patch directly | ||
+// ItemStack is; | ||
+// try | ||
+// { | ||
+// is = GameRegistry.makeItemStack(itemName, meta, 1, serializednbt); | ||
+// } catch (RuntimeException e) | ||
+// { | ||
+// FMLLog.getLogger().log(Level.ERROR, "Caught exception processing itemstack {},{},{} in annotation at {}.{}", itemName, meta, serializednbt,field.getClass().getName(),field.getName()); | ||
+// throw e; | ||
+// } | ||
+// try | ||
+// { | ||
+// Object fieldAccessor = newFieldAccessor.invoke(reflectionFactory, field, false); | ||
+// fieldAccessorSet.invoke(fieldAccessor, null, is); | ||
+// } | ||
+// catch (Exception e) | ||
+// { | ||
+// FMLLog.getLogger().log(Level.WARN, "Unable to set {} with value {},{},{}", this.field, this.itemName, this.meta, this.serializednbt); | ||
+// } | ||
ItemStack is; | ||
- try | ||
- { | ||
+ try { | ||
is = GameRegistry.makeItemStack(itemName, meta, 1, serializednbt); | ||
- } catch (RuntimeException e) | ||
- { | ||
- FMLLog.getLogger().log(Level.ERROR, "Caught exception processing itemstack {},{},{} in annotation at {}.{}", itemName, meta, serializednbt,field.getClass().getName(),field.getName()); | ||
+ } catch (RuntimeException e) { | ||
+ FMLLog.getLogger() | ||
+ .log( | ||
+ Level.ERROR, | ||
+ "Caught exception processing itemstack {},{},{} in annotation at {}.{}", | ||
+ itemName, | ||
+ meta, | ||
+ serializednbt, | ||
+ field.getClass() | ||
+ .getName(), | ||
+ field.getName()); | ||
throw e; | ||
} | ||
- try | ||
- { | ||
- Object fieldAccessor = newFieldAccessor.invoke(reflectionFactory, field, false); | ||
- fieldAccessorSet.invoke(fieldAccessor, null, is); | ||
+ try { | ||
+ fieldSetter.invoke(is); | ||
+ } catch (Throwable e) { | ||
+ FMLLog.getLogger() | ||
+ .log( | ||
+ Level.WARN, | ||
+ "Unable to set {} with value {},{},{}", | ||
+ this.field, | ||
+ this.itemName, | ||
+ this.meta, | ||
+ this.serializednbt); | ||
} | ||
- catch (Exception e) | ||
- { | ||
- FMLLog.getLogger().log(Level.WARN, "Unable to set {} with value {},{},{}", this.field, this.itemName, this.meta, this.serializednbt); | ||
- } | ||
+ // Crucible end | ||
} | ||
} |
Oops, something went wrong.