Compare commits
No commits in common. "master" and "v1.1.0+7" have entirely different histories.
39
build.gradle
39
build.gradle
|
@ -1,8 +1,11 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.3-SNAPSHOT'
|
id 'fabric-loom' version '0.6-SNAPSHOT'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
|
||||||
archivesBaseName = project.archives_base_name
|
archivesBaseName = project.archives_base_name
|
||||||
version = project.mod_version
|
version = project.mod_version
|
||||||
group = project.maven_group
|
group = project.maven_group
|
||||||
|
@ -56,15 +59,15 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
inputs.property "version", project.version
|
inputs.property "version", "${project.version}+build.${versionBuild}"
|
||||||
inputs.property "minecraft_version", project.minecraft_version
|
|
||||||
inputs.property "loader_version", project.loader_version
|
|
||||||
filteringCharset "UTF-8"
|
|
||||||
|
|
||||||
filesMatching("fabric.mod.json") {
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
expand "version": project.version,
|
include "fabric.mod.json"
|
||||||
"minecraft_version": project.minecraft_version,
|
expand "version": "${project.version}+build.${versionBuild}"
|
||||||
"loader_version": project.loader_version
|
}
|
||||||
|
|
||||||
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
|
exclude "fabric.mod.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,22 +78,20 @@ tasks.withType(JavaCompile) {
|
||||||
options.encoding = "UTF-8"
|
options.encoding = "UTF-8"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||||
|
// if it is present.
|
||||||
|
// If you remove this task, sources will not be generated.
|
||||||
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||||
|
classifier = "sources"
|
||||||
|
from sourceSets.main.allSource
|
||||||
|
}
|
||||||
|
|
||||||
gradle.taskGraph.whenReady {taskGraph ->
|
gradle.taskGraph.whenReady {taskGraph ->
|
||||||
if (taskGraph.hasTask(build)) { /* when run remapJar, build, runClient, or runServer task */
|
if (taskGraph.hasTask(build)) { /* when run remapJar, build, runClient, or runServer task */
|
||||||
autoIncrementBuildNumber()
|
autoIncrementBuildNumber()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
|
||||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
|
||||||
// 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 {
|
jar {
|
||||||
from "LICENSE"
|
from "LICENSE"
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
org.gradle.jvmargs=-Xmx1G
|
org.gradle.jvmargs=-Xmx1G
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://modmuss50.me/fabric.html
|
# check these on https://modmuss50.me/fabric.html
|
||||||
minecraft_version=1.20.1
|
minecraft_version=1.16.4
|
||||||
yarn_mappings=1.20.1+build.10
|
yarn_mappings=1.16.4+build.9
|
||||||
loader_version=0.14.22
|
loader_version=0.10.8
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.1.1
|
mod_version=1.1.0
|
||||||
maven_group=dev.pfaff
|
maven_group=dev.pfaff
|
||||||
archives_base_name=thinksame
|
archives_base_name=thinksame
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
@ -1,16 +1,117 @@
|
||||||
package dev.pfaff.thinksame.mixin;
|
package dev.pfaff.thinksame.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.Mouse;
|
import net.minecraft.client.Mouse;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.client.options.KeyBinding;
|
||||||
|
import net.minecraft.client.util.GlfwUtil;
|
||||||
|
import net.minecraft.client.util.InputUtil;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import static org.objectweb.asm.Opcodes.GETSTATIC;
|
|
||||||
|
|
||||||
|
// TODO: modify injection to not overwrite whole method.
|
||||||
@Mixin(Mouse.class)
|
@Mixin(Mouse.class)
|
||||||
public abstract class MouseMixin {
|
public abstract class MouseMixin {
|
||||||
@Redirect(method = "onMouseButton", at = @At(value = "FIELD", opcode = GETSTATIC, target = "Lnet/minecraft/client/MinecraftClient;IS_SYSTEM_MAC:Z"))
|
@Shadow @Final private MinecraftClient client;
|
||||||
private boolean onMouseButton$noMacOS() {
|
|
||||||
return false;
|
@Shadow private int field_1796;
|
||||||
|
|
||||||
|
@Shadow private int activeButton;
|
||||||
|
|
||||||
|
@Shadow private double glfwTime;
|
||||||
|
|
||||||
|
@Shadow private boolean cursorLocked;
|
||||||
|
|
||||||
|
@Shadow public abstract void lockCursor();
|
||||||
|
|
||||||
|
@Shadow private double x;
|
||||||
|
|
||||||
|
@Shadow private double y;
|
||||||
|
|
||||||
|
@Shadow private boolean leftButtonClicked;
|
||||||
|
|
||||||
|
@Shadow private boolean middleButtonClicked;
|
||||||
|
|
||||||
|
@Shadow private boolean rightButtonClicked;
|
||||||
|
|
||||||
|
@Inject(method = "onMouseButton", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void onMouseButton(long window, int button, int action, int mods, CallbackInfo ci) {
|
||||||
|
ci.cancel();
|
||||||
|
|
||||||
|
if (window == this.client.getWindow().getHandle()) {
|
||||||
|
boolean bl = action == 1;
|
||||||
|
// if (MinecraftClient.IS_SYSTEM_MAC && button == 0) {
|
||||||
|
// if (bl) {
|
||||||
|
// if ((mods & 2) == 2) {
|
||||||
|
// button = 1;
|
||||||
|
// ++this.controlLeftTicks;
|
||||||
|
// }
|
||||||
|
// } else if (this.controlLeftTicks > 0) {
|
||||||
|
// button = 1;
|
||||||
|
// --this.controlLeftTicks;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (bl) {
|
||||||
|
if (this.client.options.touchscreen && this.field_1796++ > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.activeButton = button;
|
||||||
|
this.glfwTime = GlfwUtil.getTime();
|
||||||
|
} else if (this.activeButton != -1) {
|
||||||
|
if (this.client.options.touchscreen && --this.field_1796 > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.activeButton = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean[] bls = new boolean[]{false};
|
||||||
|
if (this.client.overlay == null) {
|
||||||
|
if (this.client.currentScreen == null) {
|
||||||
|
if (!this.cursorLocked && bl) {
|
||||||
|
this.lockCursor();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
double d = this.x * (double)this.client.getWindow().getScaledWidth() / (double)this.client.getWindow().getWidth();
|
||||||
|
double e = this.y * (double)this.client.getWindow().getScaledHeight() / (double)this.client.getWindow().getHeight();
|
||||||
|
if (bl) {
|
||||||
|
Screen.wrapScreenError(() -> {
|
||||||
|
bls[0] = this.client.currentScreen.mouseClicked(d, e, button);
|
||||||
|
}, "mouseClicked event handler", this.client.currentScreen.getClass().getCanonicalName());
|
||||||
|
} else {
|
||||||
|
Screen.wrapScreenError(() -> {
|
||||||
|
bls[0] = this.client.currentScreen.mouseReleased(d, e, button);
|
||||||
|
}, "mouseReleased event handler", this.client.currentScreen.getClass().getCanonicalName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bls[0] && (this.client.currentScreen == null || this.client.currentScreen.passEvents) && this.client.overlay == null) {
|
||||||
|
if (button == 0) {
|
||||||
|
this.leftButtonClicked = bl;
|
||||||
|
} else if (button == 2) {
|
||||||
|
this.middleButtonClicked = bl;
|
||||||
|
} else if (button == 1) {
|
||||||
|
this.rightButtonClicked = bl;
|
||||||
|
}
|
||||||
|
|
||||||
|
KeyBinding.setKeyPressed(InputUtil.Type.MOUSE.createFromCode(button), bl);
|
||||||
|
if (bl) {
|
||||||
|
if (this.client.player.isSpectator() && button == 2) {
|
||||||
|
this.client.inGameHud.getSpectatorHud().useSelectedCommand();
|
||||||
|
} else {
|
||||||
|
KeyBinding.onKeyPressed(InputUtil.Type.MOUSE.createFromCode(button));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,23 @@
|
||||||
package dev.pfaff.thinksame.mixin;
|
package dev.pfaff.thinksame.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.client.util.InputUtil;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
import static org.objectweb.asm.Opcodes.GETSTATIC;
|
|
||||||
|
|
||||||
@Mixin(Screen.class)
|
@Mixin(Screen.class)
|
||||||
public abstract class ScreenMixin {
|
public abstract class ScreenMixin {
|
||||||
@Redirect(method = "hasControlDown", at = @At(value = "FIELD", opcode = GETSTATIC, target = "Lnet/minecraft/client/MinecraftClient;IS_SYSTEM_MAC:Z"))
|
@Inject(method = "hasControlDown", at = @At("HEAD"), cancellable = true)
|
||||||
private static boolean hasControlDown$noMacOS() {
|
private static void hasControlDown(CallbackInfoReturnable<Boolean> ci) {
|
||||||
return false;
|
// if (MinecraftClient.IS_SYSTEM_MAC) {
|
||||||
|
// return InputUtil.isKeyPressed(MinecraftClient.getInstance().getWindow().getHandle(), 343) || InputUtil.isKeyPressed(MinecraftClient.getInstance().getWindow().getHandle(), 347);
|
||||||
|
// } else {
|
||||||
|
// return InputUtil.isKeyPressed(MinecraftClient.getInstance().getWindow().getHandle(), 341) || InputUtil.isKeyPressed(MinecraftClient.getInstance().getWindow().getHandle(), 345);
|
||||||
|
// }
|
||||||
|
|
||||||
|
ci.setReturnValue(InputUtil.isKeyPressed(MinecraftClient.getInstance().getWindow().getHandle(), 341) || InputUtil.isKeyPressed(MinecraftClient.getInstance().getWindow().getHandle(), 345));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,14 @@
|
||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"id": "thinksame",
|
"id": "thinksame",
|
||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
"name": "Think Same",
|
"name": "ThinkSame",
|
||||||
"description": "Patches for bugs and anti-features on macOS",
|
"description": "Fixes issues on macOS including Ctrl+Left-Click simulating Right-Click.",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Michael Pfaff",
|
"name": "Michael Pfaff",
|
||||||
"contact": {
|
"contact": {
|
||||||
"email": "michael@pfaff.dev"
|
"email": "michael@pfaff.dev",
|
||||||
|
"matrix": "@michael:pfaff.dev"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -25,6 +26,6 @@
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.10.8",
|
"fabricloader": ">=0.10.8",
|
||||||
"minecraft": ">=1.16"
|
"minecraft": "1.16.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
#Mon Sep 18 16:40:55 EDT 2023
|
#Fri Mar 05 21:09:08 EST 2021
|
||||||
VERSION_BUILD=20
|
VERSION_BUILD=7
|
||||||
|
|
Loading…
Reference in New Issue