diff --git a/README.MD b/README.MD
index b9b1bf2..46d1e62 100644
--- a/README.MD
+++ b/README.MD
@@ -7,7 +7,6 @@ Bundles [RetroFuturaBootstrap](https://github.com/GTNewHorizons/RetroFuturaBoots
Lwjgl3ify depends on:
- Unimixins (), use at least version 0.1.23 with the GTNHMixins module.
- - GTNHLib (), at least 0.6.2.
Hodgepodge () is strongly recommended, it has many Java 17+ compatibility patches for ARR mods (Biomes'o'Plenty, Witchery, JourneyMap, and more) which we could not directly fix in the GTNH forks.
@@ -50,7 +49,7 @@ If you want to tweak your default window size, OpenGL context properties or othe
## Server
First, install a working 1.7.10 Forge server, from a modpack zip or using forge's installer.
-Then, install the mod jar (and unimixins, hodgepodge and gtnhlib as needed) in `mods/`, and download the `forgePatches` jar. Put the forgePatches jar in the same folder as your forge-universal and minecraft server jars.
+Then, install the mod jar (and unimixins, hodgepodge as needed) in `mods/`, and download the `forgePatches` jar. Put the forgePatches jar in the same folder as your forge-universal and minecraft server jars.
**Thermos/Crucible/Hybrid servers are not supported!**.
Lwjgl3ify also depends on Unimixins (), use at least version 0.1.7.
Rename the forgePatches jar to just `lwjgl3ify-forgePatches.jar`. Create a file named `java9args.txt` with the contents of [the file in this repository](java9args.txt).
diff --git a/dependencies.gradle b/dependencies.gradle
index 9fba02f..55d8863 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -23,8 +23,6 @@ dependencies {
vanilla_minecraft(libs.gson)
forgePatchesEmbedded(libs.gson)
- api("com.github.GTNewHorizons:GTNHLib:0.6.2:dev")
-
patchedMinecraft("org.lwjgl:lwjgl-sdl:${lwjglVersion}")
patchedMinecraft("org.lwjgl:lwjgl-sdl:${lwjglVersion}:${lwjgl3Natives}")
patchedMinecraft("org.lwjgl:lwjgl-spng:${lwjglVersion}")
diff --git a/gradle.properties b/gradle.properties
index 2bf7dc3..63ab34b 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -161,7 +161,7 @@ modrinthProjectId = eC4lt4Oy
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
-modrinthRelations = required-project\:gtnhlib
+modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
#
@@ -175,7 +175,7 @@ curseForgeProjectId = 998880
# and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
-curseForgeRelations = requiredDependency\:gtnhlib
+curseForgeRelations =
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
# projects. New projects should not use this parameter.
diff --git a/src/main/java/org/lwjglx/Lwjgl3ifyEventLoop.java b/src/main/java/org/lwjglx/Lwjgl3ifyEventLoop.java
index c78e4f9..d537f62 100644
--- a/src/main/java/org/lwjglx/Lwjgl3ifyEventLoop.java
+++ b/src/main/java/org/lwjglx/Lwjgl3ifyEventLoop.java
@@ -89,6 +89,10 @@ public class Lwjgl3ifyEventLoop {
float yoffset = mouseWheelEvent.y();
Mouse.addWheelEvent(yoffset == 0 ? (Config.INPUT_INVERT_X_WHEEL ? -xoffset : xoffset) : yoffset);
}
+ case SDL_EVENT_KEYMAP_CHANGED -> {
+ Lwjgl3ify.LOG.info("System keyboard layout changed, reloading key names");
+ Keyboard.populateKeyLookupTables();
+ }
case SDL_EVENT_KEY_DOWN, SDL_EVENT_KEY_UP -> {
handleKeyEvent();
}
diff --git a/src/main/java/org/lwjglx/input/Cursor.java b/src/main/java/org/lwjglx/input/Cursor.java
index 15a637d..1d06be6 100644
--- a/src/main/java/org/lwjglx/input/Cursor.java
+++ b/src/main/java/org/lwjglx/input/Cursor.java
@@ -21,7 +21,8 @@ import static org.lwjgl.sdl.SDLSurface.*;
import java.nio.IntBuffer;
-import org.joml.Math;
+import net.minecraft.util.MathHelper;
+
import org.lwjgl.sdl.SDL_Surface;
import org.lwjgl.system.MemoryStack;
import org.lwjglx.Sys;
@@ -93,8 +94,8 @@ public class Cursor {
sdlCursor = Sys.checkSdl(
SDL_CreateColorCursor(
sdlSurface,
- Math.clamp(xHotspot, 0, width - 1),
- Math.clamp(height - 1 - yHotspot, 0, height - 1)));
+ MathHelper.clamp_int(xHotspot, 0, width - 1),
+ MathHelper.clamp_int(height - 1 - yHotspot, 0, height - 1)));
}
}
diff --git a/src/main/java/org/lwjglx/input/Keyboard.java b/src/main/java/org/lwjglx/input/Keyboard.java
index d35e4a4..afa38c4 100644
--- a/src/main/java/org/lwjglx/input/Keyboard.java
+++ b/src/main/java/org/lwjglx/input/Keyboard.java
@@ -17,8 +17,8 @@ import org.lwjglx.opengl.Display;
import com.google.common.base.Objects;
-import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap;
-import it.unimi.dsi.fastutil.objects.Object2IntArrayMap;
+import gnu.trove.map.hash.TIntObjectHashMap;
+import gnu.trove.map.hash.TObjectIntHashMap;
import me.eigenraven.lwjgl3ify.Lwjgl3ify;
import me.eigenraven.lwjgl3ify.api.InputEvents;
import me.eigenraven.lwjgl3ify.client.MainThreadExec;
@@ -173,8 +173,8 @@ public class Keyboard {
public static ByteBuffer sdlKeyPressedArray;
- private static final Int2ObjectArrayMap keyMap = new Int2ObjectArrayMap();
- private static final Object2IntArrayMap reverseKeyMap = new Object2IntArrayMap<>();
+ private static final TIntObjectHashMap keyMap = new TIntObjectHashMap<>(512, 0.5f);
+ private static final TObjectIntHashMap reverseKeyMap = new TObjectIntHashMap<>(512, 0.5f, -1);
public enum KeyState {
@@ -230,6 +230,8 @@ public class Keyboard {
/** Populates the key name->index lookup table with the current keyboard layout based names. */
public static void populateKeyLookupTables() {
+ keyMap.clear();
+ reverseKeyMap.clear();
for (int key = 0; key <= 255; key++) {
getKeyName(key);
}
@@ -365,7 +367,8 @@ public class Keyboard {
if (keyName.equals("NONE")) {
return KEY_NONE;
}
- int ret = reverseKeyMap.getOrDefault(keyName, -1);
+
+ int ret = reverseKeyMap.get(keyName);
if (ret == -1) {
if (keyName.matches("Key -?[0-9]+]")) {
return Integer.parseInt(StringUtils.removeStart(keyName, "Key "));
diff --git a/src/main/java/org/lwjglx/opengl/Display.java b/src/main/java/org/lwjglx/opengl/Display.java
index 49fedaa..bccdfe1 100644
--- a/src/main/java/org/lwjglx/opengl/Display.java
+++ b/src/main/java/org/lwjglx/opengl/Display.java
@@ -19,8 +19,6 @@ import static org.lwjgl.system.MemoryStack.*;
import static org.lwjgl.system.MemoryUtil.*;
import java.awt.Canvas;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;
@@ -33,7 +31,6 @@ import org.lwjgl.PointerBuffer;
import org.lwjgl.opengl.GL;
import org.lwjgl.opengl.GL11;
import org.lwjgl.sdl.SDLKeyboard;
-import org.lwjgl.sdl.SDLKeycode;
import org.lwjgl.sdl.SDLVideo;
import org.lwjgl.sdl.SDL_DisplayMode;
import org.lwjgl.sdl.SDL_Surface;
@@ -43,7 +40,6 @@ import org.lwjglx.Sys;
import org.lwjglx.input.Keyboard;
import org.lwjglx.input.Mouse;
-import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import me.eigenraven.lwjgl3ify.Lwjgl3ify;
import me.eigenraven.lwjgl3ify.client.MainThreadExec;
import me.eigenraven.lwjgl3ify.core.Config;
@@ -100,27 +96,10 @@ public class Display {
private static Keyboard.KeyEvent ingredientKeyEvent;
private static ByteBuffer[] savedIcons;
private static boolean lastAltIsRightAlt = false;
- private static Int2ObjectOpenHashMap sdlKeycodeNames = new Int2ObjectOpenHashMap<>();
public static volatile long sdlWindow, sdlHiddenWindow, sdlMainGlContext, sdlCloneableGlContext;
public static int sdlWindowId;
- static {
- try {
- Class keycodeClass = SDLKeycode.class;
- for (Field f : keycodeClass.getFields()) {
- if (f.getName()
- .startsWith("SDLK") && f.getType() == int.class
- && Modifier.isStatic(f.getModifiers())) {
- int value = f.getInt(null);
- sdlKeycodeNames.put(value, f.getName());
- }
- }
- } catch (ReflectiveOperationException e) {
- // ignore
- }
- }
-
/**
* Create the OpenGL context with the given minimum parameters. If isFullscreen() is true or if windowed context are
* not supported on the platform, the display mode will be switched to the mode returned by getDisplayMode(), and a
diff --git a/src/main/resources/META-INF/rfb-plugin/lwjgl3ify.properties b/src/main/resources/META-INF/rfb-plugin/lwjgl3ify.properties
index 8271327..4a98429 100644
--- a/src/main/resources/META-INF/rfb-plugin/lwjgl3ify.properties
+++ b/src/main/resources/META-INF/rfb-plugin/lwjgl3ify.properties
@@ -3,7 +3,7 @@ version=${version}
additionalVersions=
className=me.eigenraven.lwjgl3ify.rfb.Lwjgl3ifyRfbPlugin
transformerExclusions=me.eigenraven.lwjgl3ify
-versionConstraints=gtnhlib@[0.6.2,)
+versionConstraints=
loadBefore=
loadAfter=
-loadRequires=gtnhlib
+loadRequires=