Enough transformers to get into a world

This commit is contained in:
Raven Szewczyk committed 2023-01-14 21:41:26 +00:00
1 parent 33fc6611b3
commit 2e90fac616
253 files changed
+11292 -6940

No files matched your search

@@ -9,26 +9,31 @@ public class BufferCasts {
newBuffer.asCharBuffer().put(buffer);
return newBuffer;
}
public static ByteBuffer toByteBuffer(ShortBuffer buffer) {
ByteBuffer newBuffer = ByteBuffer.allocateDirect(buffer.capacity() * 4);
newBuffer.asShortBuffer().put(buffer);
return newBuffer;
}
public static ByteBuffer toByteBuffer(IntBuffer buffer) {
ByteBuffer newBuffer = ByteBuffer.allocateDirect(buffer.capacity() * 4);
newBuffer.asIntBuffer().put(buffer);
return newBuffer;
}
public static ByteBuffer toByteBuffer(LongBuffer buffer) {
ByteBuffer newBuffer = ByteBuffer.allocateDirect(buffer.capacity() * 4);
newBuffer.asLongBuffer().put(buffer);
return newBuffer;
}
public static ByteBuffer toByteBuffer(FloatBuffer buffer) {
ByteBuffer newBuffer = ByteBuffer.allocateDirect(buffer.capacity() * 4);
newBuffer.asFloatBuffer().put(buffer);
return newBuffer;
}
public static ByteBuffer toByteBuffer(DoubleBuffer buffer) {
ByteBuffer newBuffer = ByteBuffer.allocateDirect(buffer.capacity() * 4);
newBuffer.asDoubleBuffer().put(buffer);
@@ -39,22 +44,27 @@ public class BufferCasts {
destination.clear();
destination.put(source.asCharBuffer());
}
public static void updateBuffer(ShortBuffer destination, ByteBuffer source) {
destination.clear();
destination.put(source.asShortBuffer());
}
public static void updateBuffer(IntBuffer destination, ByteBuffer source) {
destination.clear();
destination.put(source.asIntBuffer());
}
public static void updateBuffer(LongBuffer destination, ByteBuffer source) {
destination.clear();
destination.put(source.asLongBuffer());
}
public static void updateBuffer(FloatBuffer destination, ByteBuffer source) {
destination.clear();
destination.put(source.asFloatBuffer());
}
public static void updateBuffer(DoubleBuffer destination, ByteBuffer source) {
destination.clear();
destination.put(source.asDoubleBuffer());
@@ -1,6 +1,7 @@
package me.eigenraven.lwjgl3ify;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.client.Minecraft;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.common.MinecraftForge;
@@ -13,6 +14,8 @@ public class ClientProxy extends CommonProxy {
@SubscribeEvent
@SuppressWarnings("unused") // event handler
public void onRenderGameOverlayTextEvent(RenderGameOverlayEvent.Text event) {
event.right.add(2, "LWJGL version: " + org.lwjgl.Version.getVersion());
if (Minecraft.getMinecraft().gameSettings.showDebugInfo && event.type == RenderGameOverlayEvent.ElementType.TEXT) {
event.right.add(Math.min(3, event.right.size()), "LWJGL version: " + org.lwjgl.Version.getVersion());
}
}
}
@@ -2,6 +2,7 @@ package me.eigenraven.lwjgl3ify;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -17,10 +18,7 @@ public class Lwjgl3ify {
public static CommonProxy PROXY;
@Mod.EventHandler
// preInit "Run before anything else. Read your config, create blocks, items,
// etc, and register them with the GameRegistry."
public void preInit(FMLPreInitializationEvent event) {
LOG.info("LWJGL3ify reached the preinit stage");
public void postInit(FMLPostInitializationEvent event) {
PROXY.registerF3Handler();
}
}
@@ -1,6 +1,5 @@
package me.eigenraven.lwjgl3ify;
import java.util.Arrays;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
@@ -11,118 +10,6 @@ import org.objectweb.asm.commons.RemappingClassAdapter;
public class LwjglRedirectTransformer extends Remapper implements IClassTransformer {
int remaps = 0, calls = 0;
public static final String[] MAPPED_CLASSES = new String[] {
"org/lwjgl/BufferChecks",
"org/lwjgl/BufferUtils",
"org/lwjgl/LWJGLException",
"org/lwjgl/LWJGLUtil",
"org/lwjgl/MemoryUtil",
"org/lwjgl/PointerBuffer",
"org/lwjgl/PointerWrapper",
"org/lwjgl/PointerWrapperAbstract",
"org/lwjgl/Sys",
"org/lwjgl/input/Cursor",
"org/lwjgl/input/EventQueue",
"org/lwjgl/input/KeyCodes",
"org/lwjgl/input/Keyboard",
"org/lwjgl/input/Mouse",
"org/lwjgl/openal/AL",
"org/lwjgl/openal/AL10",
"org/lwjgl/openal/ALC10",
"org/lwjgl/openal/ALCcontext",
"org/lwjgl/openal/ALCdevice",
"org/lwjgl/openal/EFX10",
"org/lwjgl/openal/EFXUtil",
"org/lwjgl/openal/OpenALException",
"org/lwjgl/openal/Util",
"org/lwjgl/opengl/AWTGLCanvas",
"org/lwjgl/opengl/Context",
"org/lwjgl/opengl/ContextAttribs",
"org/lwjgl/opengl/ContextCapabilities",
"org/lwjgl/opengl/ContextGL",
"org/lwjgl/opengl/Display",
"org/lwjgl/opengl/DisplayImplementation",
"org/lwjgl/opengl/DisplayMode",
"org/lwjgl/opengl/Drawable",
"org/lwjgl/opengl/DrawableGL",
"org/lwjgl/opengl/DrawableLWJGL",
"org/lwjgl/opengl/GL15x",
"org/lwjgl/opengl/GL20x",
"org/lwjgl/opengl/GLContext",
"org/lwjgl/opengl/GLSync",
"org/lwjgl/opengl/GlobalLock",
"org/lwjgl/opengl/InputImplementation",
"org/lwjgl/opengl/OpenGLException",
"org/lwjgl/opengl/Pbuffer",
"org/lwjgl/opengl/PeerInfo",
"org/lwjgl/opengl/PixelFormat",
"org/lwjgl/opengl/PixelFormatLWJGL",
"org/lwjgl/opengl/RenderTexture",
"org/lwjgl/opengl/Sync",
"org/lwjgl/opengl/Util",
"org/lwjgl/test/opengl/Gears",
"org/lwjgl/test/spaceinvaders/AlienEntity",
"org/lwjgl/test/spaceinvaders/Entity",
"org/lwjgl/test/spaceinvaders/Game",
"org/lwjgl/test/spaceinvaders/ShipEntity",
"org/lwjgl/test/spaceinvaders/ShotEntity",
"org/lwjgl/test/spaceinvaders/SoundManager",
"org/lwjgl/test/spaceinvaders/Sprite",
"org/lwjgl/test/spaceinvaders/Texture",
"org/lwjgl/test/spaceinvaders/TextureLoader",
"org/lwjgl/util/Display",
"org/lwjgl/util/WaveData",
"org/lwjgl/util/glu/Cylinder",
"org/lwjgl/util/glu/Disk",
"org/lwjgl/util/glu/GLU",
"org/lwjgl/util/glu/GLUtessellator",
"org/lwjgl/util/glu/GLUtessellatorCallback",
"org/lwjgl/util/glu/GLUtessellatorCallbackAdapter",
"org/lwjgl/util/glu/MipMap",
"org/lwjgl/util/glu/PartialDisk",
"org/lwjgl/util/glu/PixelStoreState",
"org/lwjgl/util/glu/Project",
"org/lwjgl/util/glu/Quadric",
"org/lwjgl/util/glu/Registry",
"org/lwjgl/util/glu/Sphere",
"org/lwjgl/util/glu/Util",
"org/lwjgl/util/glu/tessellation/ActiveRegion",
"org/lwjgl/util/glu/tessellation/CachedVertex",
"org/lwjgl/util/glu/tessellation/Dict",
"org/lwjgl/util/glu/tessellation/DictNode",
"org/lwjgl/util/glu/tessellation/GLUface",
"org/lwjgl/util/glu/tessellation/GLUhalfEdge",
"org/lwjgl/util/glu/tessellation/GLUmesh",
"org/lwjgl/util/glu/tessellation/GLUtessellatorImpl",
"org/lwjgl/util/glu/tessellation/GLUvertex",
"org/lwjgl/util/glu/tessellation/Geom",
"org/lwjgl/util/glu/tessellation/Mesh",
"org/lwjgl/util/glu/tessellation/Normal",
"org/lwjgl/util/glu/tessellation/PriorityQ",
"org/lwjgl/util/glu/tessellation/PriorityQHeap",
"org/lwjgl/util/glu/tessellation/PriorityQSort",
"org/lwjgl/util/glu/tessellation/Render",
"org/lwjgl/util/glu/tessellation/Sweep",
"org/lwjgl/util/glu/tessellation/TessMono",
"org/lwjgl/util/glu/tessellation/TessState",
"org/lwjgl/util/vector/Matrix",
"org/lwjgl/util/vector/Matrix2f",
"org/lwjgl/util/vector/Matrix3f",
"org/lwjgl/util/vector/Matrix4f",
"org/lwjgl/util/vector/Quaternion",
"org/lwjgl/util/vector/ReadableVector",
"org/lwjgl/util/vector/ReadableVector2f",
"org/lwjgl/util/vector/ReadableVector3f",
"org/lwjgl/util/vector/ReadableVector4f",
"org/lwjgl/util/vector/Vector",
"org/lwjgl/util/vector/Vector2f",
"org/lwjgl/util/vector/Vector3f",
"org/lwjgl/util/vector/Vector4f",
"org/lwjgl/util/vector/WritableVector2f",
"org/lwjgl/util/vector/WritableVector3f",
"org/lwjgl/util/vector/WritableVector4f"
};
@Override
public byte[] transform(String name, String transformedName, byte[] basicClass) {
ClassReader reader = new ClassReader(basicClass);
@@ -144,7 +31,7 @@ public class LwjglRedirectTransformer extends Remapper implements IClassTransfor
calls++;
final String OLD_PREFIX = "org/lwjgl/";
final String NEW_PREFIX = "org/lwjglx/";
if (typeName.startsWith(OLD_PREFIX) && Arrays.stream(MAPPED_CLASSES).anyMatch(typeName::contains)) {
if (typeName.startsWith(OLD_PREFIX)) {
remaps++;
final String newName = NEW_PREFIX + typeName.substring(OLD_PREFIX.length());
return newName;
@@ -1,4 +1,3 @@
package org.lwjglx.opengl;
public class ARBBufferObject {
}
public class ARBBufferObject {}
@@ -1,4 +1,3 @@
package org.lwjglx.opengl;
public class ARBProgram {
}
public class ARBProgram {}