Commit 3470648e2419eff458c71f99fb278f0ffd20c170

Authored by Mumfrey
1 parent b8785b2a

compatibility with current Forge builds

java/client/com/mumfrey/liteloader/client/api/ObjectFactoryClient.java
@@ -2,6 +2,7 @@ package com.mumfrey.liteloader.client.api; @@ -2,6 +2,7 @@ package com.mumfrey.liteloader.client.api;
2 2
3 import net.minecraft.client.Minecraft; 3 import net.minecraft.client.Minecraft;
4 import net.minecraft.client.gui.GuiScreen; 4 import net.minecraft.client.gui.GuiScreen;
  5 +import net.minecraft.launchwrapper.Launch;
5 import net.minecraft.server.integrated.IntegratedServer; 6 import net.minecraft.server.integrated.IntegratedServer;
6 7
7 import com.mumfrey.liteloader.client.LiteLoaderEventBrokerClient; 8 import com.mumfrey.liteloader.client.LiteLoaderEventBrokerClient;
@@ -149,6 +150,15 @@ class ObjectFactoryClient implements ObjectFactory<Minecraft, IntegratedServer> @@ -149,6 +150,15 @@ class ObjectFactoryClient implements ObjectFactory<Minecraft, IntegratedServer>
149 @Override 150 @Override
150 public void preBeginGame() 151 public void preBeginGame()
151 { 152 {
  153 + try
  154 + {
  155 + Class<?> progressManagerClass = Class.forName("net.minecraftforge.fml.common.ProgressManager", false, Launch.classLoader);
  156 + return; // Disable my loading bar if Forge's is present
  157 + }
  158 + catch (ClassNotFoundException ex)
  159 + {
  160 + }
  161 +
152 new LoadingBar(); 162 new LoadingBar();
153 } 163 }
154 } 164 }
java/common/com/mumfrey/liteloader/transformers/ClassTransformer.java
@@ -40,7 +40,7 @@ public abstract class ClassTransformer implements IClassTransformer @@ -40,7 +40,7 @@ public abstract class ClassTransformer implements IClassTransformer
40 if (this.classReader != null && this.classNode == classNode) 40 if (this.classReader != null && this.classNode == classNode)
41 { 41 {
42 this.classNode = null; 42 this.classNode = null;
43 - ClassWriter writer = new ClassWriter(this.classReader, ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES); 43 + IsolatedClassWriter writer = new IsolatedClassWriter(this.classReader, ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
44 this.classReader = null; 44 this.classReader = null;
45 classNode.accept(writer); 45 classNode.accept(writer);
46 return writer.toByteArray(); 46 return writer.toByteArray();
@@ -48,7 +48,7 @@ public abstract class ClassTransformer implements IClassTransformer @@ -48,7 +48,7 @@ public abstract class ClassTransformer implements IClassTransformer
48 48
49 this.classNode = null; 49 this.classNode = null;
50 50
51 - ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES); 51 + IsolatedClassWriter writer = new IsolatedClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
52 classNode.accept(writer); 52 classNode.accept(writer);
53 return writer.toByteArray(); 53 return writer.toByteArray();
54 } 54 }
java/common/com/mumfrey/liteloader/transformers/IsolatedClassWriter.java 0 → 100644
  1 +package com.mumfrey.liteloader.transformers;
  2 +
  3 +import org.objectweb.asm.ClassReader;
  4 +import org.objectweb.asm.ClassWriter;
  5 +
  6 +/**
  7 + * ClassWriter isolated from ASM so that it exists in the LaunchClassLoader
  8 + *
  9 + * @author Adam Mummery-Smith
  10 + */
  11 +public class IsolatedClassWriter extends ClassWriter
  12 +{
  13 + public IsolatedClassWriter(int flags)
  14 + {
  15 + super(flags);
  16 + }
  17 +
  18 + public IsolatedClassWriter(ClassReader classReader, int flags)
  19 + {
  20 + super(classReader, flags);
  21 + }
  22 +}