Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. public class Transformer implements IClassTransformer
  2. {
  3.  
  4. static
  5. {
  6. stopMemoryOverflow();
  7. }
  8. /**
  9. * stop the memory overflowing and new objects from instantiating
  10. */
  11. public static void stopMemoryOverflow()
  12. {
  13. System.out.println("Fixing Forge Dupe Loading Byte Class Cache(net.minecraft.launchwrapper.LaunchClassLoader.resourceCache)");
  14. Map<String,byte[]> init = (Map<String, byte[]>) ReflectionUtil.getObject(Launch.classLoader, LaunchClassLoader.class, "resourceCache");
  15. init.clear();
  16. ReflectionUtil.setObject(Launch.classLoader, new DummyMap<String,byte[]>(), LaunchClassLoader.class, "resourceCache");
  17. System.out.println("Fixing Forge Dupe Loading Class net.minecraft.launchwrapper.LaunchClassLoader.cachedClasses:");
  18. Map<String,Class<?>> transformedCache = (Map<String, Class<?>>) ReflectionUtil.getObject(Launch.classLoader, LaunchClassLoader.class, "cachedClasses");
  19. transformedCache.clear();
  20. ReflectionUtil.setObject(Launch.classLoader, new DummyMap<String,Class<?>>(), LaunchClassLoader.class, "cachedClasses");
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement