File tree Expand file tree Collapse file tree 6 files changed +31
-15
lines changed
src/main/java/com/ishland/fixkeyboardonlinux Expand file tree Collapse file tree 6 files changed +31
-15
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,10 @@ jobs:
1212 matrix :
1313 # Use these Java versions
1414 java : [
15- 17 , # Current Java LTS & minimum supported by Minecraft
15+ 21 , # Current Java LTS & minimum supported by Minecraft
1616 ]
1717 # and run on Linux
18- os : [ubuntu-20 .04]
18+ os : [ubuntu-24 .04]
1919 runs-on : ${{ matrix.os }}
2020 steps :
2121 - name : checkout repository
3232 - name : build
3333 run : ./gradlew build
3434 - name : capture build artifacts
35- if : ${{ runner.os == 'Linux' && matrix.java == '17 ' }} # Only upload artifacts built from latest java on one OS
35+ if : ${{ runner.os == 'Linux' && matrix.java == '21 ' }} # Only upload artifacts built from latest java on one OS
3636 uses : actions/upload-artifact@v2
3737 with :
3838 name : Artifacts
Original file line number Diff line number Diff line change 11plugins {
2- id ' fabric-loom' version ' 1.4 -SNAPSHOT'
2+ id ' fabric-loom' version ' 1.11 -SNAPSHOT'
33 id ' maven-publish'
44}
55
6- sourceCompatibility = JavaVersion . VERSION_17
7- targetCompatibility = JavaVersion . VERSION_17
6+ java {
7+ sourceCompatibility = JavaVersion . VERSION_17
8+ targetCompatibility = JavaVersion . VERSION_17
9+ }
10+
11+ base {
12+ archivesName = project. archives_base_name
13+ }
814
9- archivesBaseName = project. archives_base_name
1015version = project. mod_version
1116group = project. maven_group
1217
5560
5661jar {
5762 from(" LICENSE" ) {
58- rename { " ${ it} _${ project.archivesBaseName } " }
63+ rename { " ${ it} _${ project.archives_base_name } " }
5964 }
6065}
6166
Original file line number Diff line number Diff line change @@ -3,14 +3,12 @@ org.gradle.jvmargs=-Xmx1G
33
44# Fabric Properties
55 # check these on https://fabricmc.net/develop
6- minecraft_version =1.20.4
7- yarn_mappings =1.20.4 +build.3
8- loader_version =0.15.3
6+ minecraft_version =1.21.9-rc1
7+ yarn_mappings =1.21.9-rc1 +build.1
8+ loader_version =0.17.2
99
1010# Mod Properties
1111 mod_version = 1.0.1
1212 maven_group = com.ishland.fabric
1313 archives_base_name = fix-keyboard-on-linux
1414
15- # Dependencies
16- fabric_version =0.55.1+1.19
Original file line number Diff line number Diff line change 11distributionBase =GRADLE_USER_HOME
22distributionPath =wrapper/dists
3- distributionUrl =https\://services.gradle.org/distributions/gradle-8.4 -all.zip
3+ distributionUrl =https\://services.gradle.org/distributions/gradle-9.1.0 -all.zip
44zipStoreBase =GRADLE_USER_HOME
55zipStorePath =wrapper/dists
Original file line number Diff line number Diff line change 11package com .ishland .fixkeyboardonlinux ;
22
3+ import io .netty .util .internal .PlatformDependent ;
34import net .fabricmc .api .ModInitializer ;
5+ import org .lwjgl .glfw .GLFW ;
46
57public class TheMod implements ModInitializer {
8+
9+ public static final int KEY_LEFT_CTRL = PlatformDependent .isOsx () ? GLFW .GLFW_KEY_LEFT_SUPER : GLFW .GLFW_KEY_LEFT_CONTROL ;
10+ public static final int KEY_RIGHT_CTRL = PlatformDependent .isOsx () ? GLFW .GLFW_KEY_RIGHT_SUPER : GLFW .GLFW_KEY_RIGHT_CONTROL ;
11+
612 @ Override
713 public void onInitialize () {
814
Original file line number Diff line number Diff line change 11package com .ishland .fixkeyboardonlinux .mixin ;
22
3+ import com .ishland .fixkeyboardonlinux .TheMod ;
34import net .minecraft .client .Keyboard ;
45import net .minecraft .client .MinecraftClient ;
56import net .minecraft .client .gui .screen .Screen ;
@@ -15,7 +16,13 @@ public class MixinKeyboard {
1516
1617 @ Inject (method = "onChar" , at = @ At (value = "HEAD" ), cancellable = true )
1718 private void beforeOnChar (CallbackInfo ci ) {
18- if (Screen .hasControlDown () || InputUtil .isKeyPressed (MinecraftClient .getInstance ().getWindow ().getHandle (), GLFW .GLFW_KEY_LEFT_ALT )) ci .cancel ();
19+ long handle = MinecraftClient .getInstance ().getWindow ().getHandle ();
20+
21+ if (GLFW .glfwGetKey (handle , TheMod .KEY_LEFT_CTRL ) == GLFW .GLFW_PRESS ||
22+ GLFW .glfwGetKey (handle , TheMod .KEY_RIGHT_CTRL ) == GLFW .GLFW_PRESS ||
23+ GLFW .glfwGetKey (handle , GLFW .GLFW_KEY_LEFT_ALT ) == GLFW .GLFW_PRESS ) {
24+ ci .cancel ();
25+ }
1926 }
2027
2128}
You can’t perform that action at this time.
0 commit comments