Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
matrix:
# Use these Java versions
java: [
17, # Current Java LTS & minimum supported by Minecraft
21, # Current Java LTS & minimum supported by Minecraft
]
# and run on macOS only since it needs xcode tools
os: [macOS-latest]
Expand All @@ -37,7 +37,7 @@ jobs:
- name: build
run: ./gradlew build
- name: capture build artifacts
if: ${{ runner.os == 'macOS' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS
if: ${{ runner.os == 'macOS' && matrix.java == '21' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v4
with:
name: Artifacts
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ If you make changes, you should test everything works properly on the following
- 1.21
- 1.21.2
- 1.21.5
- 1.21.9

## Mixin Naming Scheme

Expand All @@ -79,6 +80,8 @@ Some mixins are in a folder called `gui`, these mixins are to do with the option
9. 1 and has `MouseOptionsScreen.init()` (1.19-1.20.x)
10. Has `PlayerInventory.scrollInHotbar(double)` (1.14-1.21.1)
11. Doesn't have `PlayerInventory.scrollInHotbar(double)` (1.21.2+)
12. Has `Screen.hasControlDown()` / doesn't have `KeyInput` (1.14-1.21.8)
13. Doesn't have `Screen.hasControlDown()` / has `KeyInput` (1.21.9+)

## License

Expand Down
29 changes: 23 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
plugins {
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'fabric-loom' version "${loom_version}"
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group

base {
archivesName = project.archives_base_name
}

repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
Expand All @@ -18,6 +18,18 @@ repositories {
// for more information about repositories.
}

loom {
splitEnvironmentSourceSets()

mods {
"macos_input_fixes" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}

}

dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
Expand Down Expand Up @@ -48,11 +60,16 @@ java {
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

jar {
inputs.property "archivesName", project.base.archivesName

from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
rename { "${it}_${inputs.properties.archivesName}"}
}
}

Expand Down
7 changes: 4 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.4
loader_version=0.14.22
minecraft_version=1.21.9
yarn_mappings=1.21.9+build.1
loader_version=0.15.0
loom_version=1.11-SNAPSHOT

# Mod Properties
mod_version = 1.10
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
20 changes: 10 additions & 10 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
pluginManagement
{
repositories
{
maven
{
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
mavenCentral()
gradlePluginPortal()
}
repositories
{
maven
{
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
mavenCentral()
gradlePluginPortal()
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.hamarb123.macos_input_fixes;
package com.hamarb123.macos_input_fixes.client;

import com.hamarb123.macos_input_fixes.compat.IxerisCompat;
import com.hamarb123.macos_input_fixes.mixin.MinecraftClientAccessor;
import com.hamarb123.macos_input_fixes.client.compat.IxerisCompat;
import com.hamarb123.macos_input_fixes.client.mixin.MinecraftClientAccessor;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.InputUtil;
import net.minecraft.util.Util;
import net.minecraft.util.Util.OperatingSystem;

@Environment(EnvType.CLIENT)
public class Common
Expand All @@ -18,7 +19,7 @@ public static boolean hasControlDownInjector()
boolean returnValue;

//if not on macOS, use normal implementation
if (!MinecraftClient.IS_SYSTEM_MAC)
if (!IS_SYSTEM_MAC)
{
returnValue = FabricReflectionHelper.Screen_hasControlDown();
}
Expand All @@ -27,8 +28,8 @@ public static boolean hasControlDownInjector()
//replace hasControlDown() on macOS with hasControlDown() (which tests command) or 'actual control down' for this function only
returnValue = FabricReflectionHelper.Screen_hasControlDown() ||
//ctrl key check
InputUtil.isKeyPressed(((MinecraftClientAccessor)MinecraftClient.getInstance()).getWindow().getHandle(), 341) ||
InputUtil.isKeyPressed(((MinecraftClientAccessor)MinecraftClient.getInstance()).getWindow().getHandle(), 345);
FabricReflectionHelper.InputUtil_isKeyPressed_1(((MinecraftClientAccessor)MinecraftClient.getInstance()).getWindow().getHandle(), 341) ||
FabricReflectionHelper.InputUtil_isKeyPressed_1(((MinecraftClientAccessor)MinecraftClient.getInstance()).getWindow().getHandle(), 345);
}

//restore injector and return
Expand Down Expand Up @@ -108,4 +109,12 @@ public static void runOnRenderThreadHelper(Runnable runnable)
runnable.run();
}
}

//helper for when java struggles with undefined types
public static Object asObject(Object o)
{
return o;
}

public static final boolean IS_SYSTEM_MAC = Util.getOperatingSystem() == OperatingSystem.OSX;
}
Loading