Fix mouse wheel with lwjgl3 (#106)

* Fix mouse wheel with lwjgl3

* updateBuildScript, revert dependency change
This commit is contained in:
miozune authored and GitHub committed 2023-03-04 16:15:11 +01:00
1 parent 447450d541
commit d32a8e88a3
4 files changed
+19 -6

No files matched your search

+5 -4
View File
@@ -1,4 +1,4 @@
//version: 1677142954
//version: 1677938302
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
@@ -695,13 +695,13 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies"
}
dependencies {
def lwjgl3ifyVersion = '1.1.28'
def lwjgl3ifyVersion = '1.1.35'
def asmVersion = '9.4'
if (modId != 'lwjgl3ify') {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
}
if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.0.35')
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.0.40')
}
java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false}
@@ -718,8 +718,8 @@ dependencies {
ext.java17JvmArgs = [
// Java 9+ support
"--illegal-access=warn",
"-Dfile.encoding=UTF-8",
"-Djava.security.manager=allow",
"-Dfile.encoding=UTF-8",
"--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",
@@ -730,6 +730,7 @@ ext.java17JvmArgs = [
"--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-modules", "jdk.dynalink",
"--add-opens", "jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED",
@@ -206,6 +206,8 @@ public class EnderIO {
public static final Lang lang = new Lang("enderio");
public static final boolean hasLwjgl3 = Loader.isModLoaded("lwjgl3ify");
// Materials
public static ItemCapacitor itemBasicCapacitor;
public static ItemAlloy itemAlloy;
@@ -17,6 +17,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
@@ -180,7 +181,11 @@ public class GuiEnderface extends GuiScreen {
}
}
distance -= Mouse.getDWheel() * 0.01;
int wheelD = Mouse.getEventDWheel();
if (!EnderIO.hasLwjgl3) {
wheelD = MathHelper.clamp_int(wheelD, -1, 1);
}
distance -= wheelD;
distance = VecmathUtil.clamp(distance, 0.1, 20);
long elapsed = EnderIO.proxy.getTickCount() - initTime;
@@ -17,6 +17,7 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
@@ -156,7 +157,11 @@ public class IoConfigRenderer {
}
}
distance -= Mouse.getEventDWheel() * 0.01;
int wheelD = Mouse.getEventDWheel();
if (!EnderIO.hasLwjgl3) {
wheelD = MathHelper.clamp_int(wheelD, -1, 1);
}
distance -= wheelD;
distance = VecmathUtil.clamp(distance, 0.01, 200);
long elapsed = System.currentTimeMillis() - initTime;