From 84bb6590295ffa25b140e7a0aff71afbe346fe0f Mon Sep 17 00:00:00 2001 From: VipCoder8 <114797944+VipCoder8@users.noreply.github.com> Date: Sat, 15 Mar 2025 22:59:29 +0300 Subject: [PATCH 1/5] Backported to 1.20.1 - Fixed player inventory keybind issues if sprint set to toggle - Backported the excluding undead horses for swimming feature - Merged GirlInPurple's changes as they were not present in this branch. --- build.gradle | 4 +- gradle.properties | 8 +-- gradle/wrapper/gradle-wrapper.properties | 2 +- .../java/net/F53/HorseBuff/ClientInit.java | 56 +++++++++++++++++++ .../net/F53/HorseBuff/config/ModConfig.java | 10 +++- .../mixin/Client/InventoryAccessor.java | 10 ++-- .../net/F53/HorseBuff/mixin/Client/Swim.java | 49 ++++++++++++++++ .../net/F53/HorseBuff/mixin/Server/Swim.java | 25 --------- .../net/F53/HorseBuff/utils/KeyInput.java | 20 +++++++ .../assets/horsebuff/lang/en_us.json | 16 +++++- src/main/resources/fabric.mod.json | 3 +- src/main/resources/horsebuff.mixins.json | 6 +- 12 files changed, 165 insertions(+), 44 deletions(-) create mode 100644 src/main/java/net/F53/HorseBuff/ClientInit.java create mode 100644 src/main/java/net/F53/HorseBuff/mixin/Client/Swim.java delete mode 100644 src/main/java/net/F53/HorseBuff/mixin/Server/Swim.java create mode 100644 src/main/java/net/F53/HorseBuff/utils/KeyInput.java diff --git a/build.gradle b/build.gradle index 3c17055..fd430d4 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.11-SNAPSHOT' + id 'fabric-loom' version '1.8-SNAPSHOT' id 'maven-publish' } @@ -38,7 +38,7 @@ dependencies { modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" // Fabric API - //modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" modIncludeImplementation(fabricApi.module("fabric-api-base", project.fabric_version)) modIncludeImplementation(fabricApi.module("fabric-rendering-data-attachment-v1", project.fabric_version)) modIncludeImplementation(fabricApi.module("fabric-lifecycle-events-v1", project.fabric_version)) diff --git a/gradle.properties b/gradle.properties index 7f17c33..947a9c2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,9 +4,9 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/develop/ -minecraft_version=1.20 -yarn_mappings=1.20+build.1 -loader_version=0.14.21 +minecraft_version=1.20.1 +yarn_mappings=1.20.1+build.10 +loader_version=0.16.10 # Mod Properties mod_version = 2.1.3 @@ -14,7 +14,7 @@ maven_group = com.HorseBuff archives_base_name = HorseBuff # Dependencies -fabric_version=0.83.0+1.20 +fabric_version=0.92.3+1.20.1 cloth_config_version=11.0.99 mod_menu_version=7.0.1 mixinextras_version=0.2.0 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ffed3a2..e1adfb4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/net/F53/HorseBuff/ClientInit.java b/src/main/java/net/F53/HorseBuff/ClientInit.java new file mode 100644 index 0000000..94b4206 --- /dev/null +++ b/src/main/java/net/F53/HorseBuff/ClientInit.java @@ -0,0 +1,56 @@ +package net.F53.HorseBuff; + +import net.F53.HorseBuff.utils.KeyInput; +import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; +import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; +import net.minecraft.block.AbstractBlock; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.ingame.InventoryScreen; +import net.minecraft.client.option.KeyBinding; +import net.minecraft.client.util.InputUtil; +import net.minecraft.entity.passive.AbstractHorseEntity; +import org.lwjgl.glfw.GLFW; + +public class ClientInit implements ClientModInitializer { + + private boolean isInventoryOpened = false; + private KeyInput keyInput = new KeyInput(); + + public static KeyBinding horsePlayerInventory = KeyBindingHelper.registerKeyBinding(new KeyBinding( + "text.HorseBuff.keybinding.horsePlayerInventory", + InputUtil.Type.KEYSYM, + GLFW.GLFW_KEY_LEFT_ALT, + "text.HorseBuff.keybinding.category" + )); + + @Override + public void onInitializeClient() { + ClientTickEvents.END_CLIENT_TICK.register(client -> { + openPlayerInventory(client); + }); + } + + private void openPlayerInventory(MinecraftClient client) { + if(client.player == null) { + return; + } + if(!(client.player.getVehicle() instanceof AbstractHorseEntity)) { + return; + } + if(client.currentScreen == null) { + isInventoryOpened = false; + } + if(keyInput.isKeyReleased(client.getWindow().getHandle(), horsePlayerInventory)) { + if(!isInventoryOpened) { + if(client.currentScreen == null) { + client.setScreen(new InventoryScreen(client.player)); + isInventoryOpened = true; + } + } else { + client.setScreen(null); + isInventoryOpened = false; + } + } + } +} \ No newline at end of file diff --git a/src/main/java/net/F53/HorseBuff/config/ModConfig.java b/src/main/java/net/F53/HorseBuff/config/ModConfig.java index 79127f0..4016336 100644 --- a/src/main/java/net/F53/HorseBuff/config/ModConfig.java +++ b/src/main/java/net/F53/HorseBuff/config/ModConfig.java @@ -35,7 +35,15 @@ public class ModConfig implements ConfigData{ @ConfigEntry.Category("Client") @ConfigEntry.Gui.Tooltip - public boolean swim = true; + public boolean swimHorse = true; + + @ConfigEntry.Category("Client") + @ConfigEntry.Gui.Tooltip + public boolean swimCamel = false; + + @ConfigEntry.Category("Client") + @ConfigEntry.Gui.Tooltip + public boolean swimDead = false; @ConfigEntry.Category("Client") @ConfigEntry.Gui.Tooltip diff --git a/src/main/java/net/F53/HorseBuff/mixin/Client/InventoryAccessor.java b/src/main/java/net/F53/HorseBuff/mixin/Client/InventoryAccessor.java index b5062be..28a3157 100644 --- a/src/main/java/net/F53/HorseBuff/mixin/Client/InventoryAccessor.java +++ b/src/main/java/net/F53/HorseBuff/mixin/Client/InventoryAccessor.java @@ -6,6 +6,7 @@ import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.tutorial.TutorialManager; import org.jetbrains.annotations.Nullable; +import org.lwjgl.glfw.GLFW; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -21,13 +22,14 @@ public abstract class InventoryAccessor { @Shadow @Nullable public ClientPlayerEntity player; @Redirect(method= "handleInputEvents()V", at = @At(value = "INVOKE", target = "net/minecraft/client/network/ClientPlayerEntity.openRidingInventory ()V")) - void playerInventoryAccess(ClientPlayerEntity instance){ + void playerInventoryAccess(ClientPlayerEntity instance) { assert this.player != null; - if (MinecraftClient.getInstance().options.sprintKey.isPressed()) { + boolean leftControl = GLFW.glfwGetKey(MinecraftClient.getInstance().getWindow().getHandle(), GLFW.GLFW_KEY_LEFT_CONTROL) == 1; + boolean rightControl = GLFW.glfwGetKey(MinecraftClient.getInstance().getWindow().getHandle(), GLFW.GLFW_KEY_RIGHT_CONTROL) == 1; + if (leftControl || rightControl) { tutorialManager.onInventoryOpened(); setScreen(new InventoryScreen(this.player)); - } - else { + } else { instance.openRidingInventory(); } } diff --git a/src/main/java/net/F53/HorseBuff/mixin/Client/Swim.java b/src/main/java/net/F53/HorseBuff/mixin/Client/Swim.java new file mode 100644 index 0000000..6253491 --- /dev/null +++ b/src/main/java/net/F53/HorseBuff/mixin/Client/Swim.java @@ -0,0 +1,49 @@ +package net.F53.HorseBuff.mixin.Client; + +import net.F53.HorseBuff.config.ModConfig; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.mob.SkeletonHorseEntity; +import net.minecraft.entity.mob.ZombieHorseEntity; +import net.minecraft.entity.passive.*; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.registry.tag.FluidTags; +import net.minecraft.util.math.Vec3d; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(value = LivingEntity.class) +public class Swim { + @Inject(method = "travelControlled", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;travel(Lnet/minecraft/util/math/Vec3d;)V", shift = At.Shift.BEFORE)) + private void fakeSwim(PlayerEntity controllingPlayer, Vec3d movementInput, CallbackInfo ci) { + if (!((Object)this instanceof AbstractHorseEntity)) {return;} + AbstractHorseEntity horseInstance = (AbstractHorseEntity) (Object) this; + if (!shouldSwim(horseInstance)) {return;} + + if (horseInstance.getFluidHeight(FluidTags.WATER) > horseInstance.getSwimHeight()) { + horseInstance.addVelocity(0, 0.08, 0); + } + } + + @Unique + private boolean shouldSwim(AbstractHorseEntity horseInstance) { + if (horseInstance instanceof HorseEntity || + horseInstance instanceof DonkeyEntity || + horseInstance instanceof MuleEntity) { + return ModConfig.getInstance().swimHorse; + } + + if (horseInstance instanceof SkeletonHorseEntity || + horseInstance instanceof ZombieHorseEntity) { + return ModConfig.getInstance().swimDead; + } + + if (horseInstance instanceof CamelEntity) { + return ModConfig.getInstance().swimCamel; + } + + return false; // you should never be able to reach this, but if you do it defaults to vanilla behavior + } +} \ No newline at end of file diff --git a/src/main/java/net/F53/HorseBuff/mixin/Server/Swim.java b/src/main/java/net/F53/HorseBuff/mixin/Server/Swim.java deleted file mode 100644 index faee91e..0000000 --- a/src/main/java/net/F53/HorseBuff/mixin/Server/Swim.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.F53.HorseBuff.mixin.Server; - -import net.F53.HorseBuff.config.ModConfig; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.passive.AbstractHorseEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.registry.tag.FluidTags; -import net.minecraft.util.math.Vec3d; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(value = LivingEntity.class) -public class Swim { - @Inject(method = "travelControlled", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;travel(Lnet/minecraft/util/math/Vec3d;)V", shift = At.Shift.BEFORE)) - private void fakeSwim(PlayerEntity controllingPlayer, Vec3d movementInput, CallbackInfo ci) { - if (ModConfig.getInstance().swim && ((LivingEntity)(Object)this instanceof AbstractHorseEntity)) { - AbstractHorseEntity instance = ((AbstractHorseEntity)(Object)this); - if (instance.getFluidHeight(FluidTags.WATER) > instance.getSwimHeight()) { - instance.addVelocity(0, 0.08, 0); - } - } - } -} diff --git a/src/main/java/net/F53/HorseBuff/utils/KeyInput.java b/src/main/java/net/F53/HorseBuff/utils/KeyInput.java new file mode 100644 index 0000000..51a8baf --- /dev/null +++ b/src/main/java/net/F53/HorseBuff/utils/KeyInput.java @@ -0,0 +1,20 @@ +package net.F53.HorseBuff.utils; + +import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; +import net.minecraft.client.option.KeyBinding; +import org.lwjgl.glfw.GLFW; + +public class KeyInput { + private boolean wasKeyPressed = false; + public boolean isKeyReleased(long window, KeyBinding key) { + if(GLFW.glfwGetKey(window, KeyBindingHelper.getBoundKeyOf(key).getCode()) == 1) { + wasKeyPressed = true; + } else { + if(wasKeyPressed) { + wasKeyPressed = false; + return true; + } + } + return false; + } +} diff --git a/src/main/resources/assets/horsebuff/lang/en_us.json b/src/main/resources/assets/horsebuff/lang/en_us.json index 7f07f41..32a7eca 100644 --- a/src/main/resources/assets/horsebuff/lang/en_us.json +++ b/src/main/resources/assets/horsebuff/lang/en_us.json @@ -27,8 +27,14 @@ "text.autoconfig.HorseBuff.option.noBuck": "Disable Random Bucking", "text.autoconfig.HorseBuff.option.noBuck.@Tooltip": "Yes - Prevents horses from randomly bucking while mounted, no more random stops!\nNo - vanilla behavior", - "text.autoconfig.HorseBuff.option.swim": "Horse Swimming", - "text.autoconfig.HorseBuff.option.swim.@Tooltip": "Yes - Lets horses swim when you are riding them.\nNo - Horses sink when you ride them in water (vanilla behavior)", + "text.autoconfig.HorseBuff.option.swimHorse": "Horse, Mules, and Donkeys Swim", + "text.autoconfig.HorseBuff.option.swimHorse.@Tooltip": "Yes - Lets horses, mules, and donkeys swim when you are riding them.\nNo - Horses, mules, and donkeys sink when you ride them in water (vanilla behavior)", + + "text.autoconfig.HorseBuff.option.swimCamel": "Camels Swim", + "text.autoconfig.HorseBuff.option.swimCamel.@Tooltip": "Yes - Lets camels swim when you are riding them.\nNo - Camels sink when you ride them in water (vanilla behavior)", + + "text.autoconfig.HorseBuff.option.swimDead": "Undead Horses Swim", + "text.autoconfig.HorseBuff.option.swimDead.@Tooltip": "Yes - Lets Skeleton and Zombie horses swim when you are riding them.\nNo - Skeleton and Zombie horses sink when you ride them in water (vanilla behavior)", "text.autoconfig.HorseBuff.option.pitchFade": "Horse Fade", "text.autoconfig.HorseBuff.option.pitchFade.@Tooltip": "When mounted, the horse gets more transparent the further you look down", @@ -48,5 +54,9 @@ "text.autoconfig.HorseBuff.option.horseHeadAngleOffset.@Tooltip": "When mounted, horse heads are angled an extra N degrees down\n 0 is disabled\n 30 is good for visibility and style\n 45 is good for breaking necks", "text.autoconfig.HorseBuff.option.jeb_Horses": "jeb_ Horses", - "text.autoconfig.HorseBuff.option.jeb_Horses.@Tooltip": "Like sheep, horses will become RGB when named \"jeb\"" + "text.autoconfig.HorseBuff.option.jeb_Horses.@Tooltip": "Like sheep, horses will become RGB when named \"jeb\"", + + + "text.HorseBuff.keybinding.category": "Horse Buff", + "text.HorseBuff.keybinding.horsePlayerInventory": "Open Inventory on Horse" } \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 21819a1..23dce27 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -21,6 +21,7 @@ "environment": "*", "entrypoints": { "main": [ "net.F53.HorseBuff.HorseBuffInit" ], + "client": ["net.F53.HorseBuff.ClientInit"], "modmenu": [ "net.F53.HorseBuff.config.ModMenuIntegration" ] }, "mixins": [ @@ -28,7 +29,7 @@ ], "depends": { - "fabricloader": ">=0.14.6", + "fabricloader": ">=0.16.9", "minecraft": ">=1.20 <1.20.2-", "java": ">=17" } diff --git a/src/main/resources/horsebuff.mixins.json b/src/main/resources/horsebuff.mixins.json index 2d7d8b4..583e097 100644 --- a/src/main/resources/horsebuff.mixins.json +++ b/src/main/resources/horsebuff.mixins.json @@ -12,8 +12,7 @@ "Server.MovementCheck", "Server.NoBuck", "Server.NoWander", - "Server.StepHeight", - "Server.Swim" + "Server.StepHeight" ], "client": [ "Client.HeadPitchOffset", @@ -22,7 +21,8 @@ "Client.JebHorseTintable", "Client.TransparentArmor", "Client.TransparentLlamaDecor", - "Client.TransparentMarkings" + "Client.TransparentMarkings", + "Client.Swim" ], "injectors": { "defaultRequire": 1 From c34a45476349f60cc47feb56e8dbe0dc22ff9dfe Mon Sep 17 00:00:00 2001 From: VipCoder8 <114797944+VipCoder8@users.noreply.github.com> Date: Sun, 16 Mar 2025 12:19:35 +0300 Subject: [PATCH 2/5] Backported to 1.20.1 - Fixed player inventory keybind issues if sprint set to toggle - Backported the excluding undead horses for swimming feature - Merged GirlInPurple's changes as they were not present in this branch. --- src/main/java/net/F53/HorseBuff/HorseBuffInit.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/net/F53/HorseBuff/HorseBuffInit.java b/src/main/java/net/F53/HorseBuff/HorseBuffInit.java index 088b3f2..73fd62f 100644 --- a/src/main/java/net/F53/HorseBuff/HorseBuffInit.java +++ b/src/main/java/net/F53/HorseBuff/HorseBuffInit.java @@ -6,6 +6,7 @@ import net.F53.HorseBuff.config.ModConfig; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; +import net.minecraft.client.particle.RainSplashParticle; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.server.world.ServerWorld; From 14bfcd53d9623fc8f6c9537e9ca8cfffe2660ff4 Mon Sep 17 00:00:00 2001 From: VipCoder8 <114797944+VipCoder8@users.noreply.github.com> Date: Wed, 19 Mar 2025 14:06:46 +0300 Subject: [PATCH 3/5] Backported to 1.20.1 - Fixed player inventory keybind issues if sprint set to toggle - Backported the excluding undead horses for swimming feature - Merged GirlInPurple's changes as they were not present in this branch. --- .../java/net/F53/HorseBuff/ClientInit.java | 34 ------------------- .../mixin/Client/InventoryAccessor.java | 6 ++-- .../net/F53/HorseBuff/utils/KeyInput.java | 20 ----------- 3 files changed, 2 insertions(+), 58 deletions(-) delete mode 100644 src/main/java/net/F53/HorseBuff/utils/KeyInput.java diff --git a/src/main/java/net/F53/HorseBuff/ClientInit.java b/src/main/java/net/F53/HorseBuff/ClientInit.java index 94b4206..20818bc 100644 --- a/src/main/java/net/F53/HorseBuff/ClientInit.java +++ b/src/main/java/net/F53/HorseBuff/ClientInit.java @@ -1,22 +1,13 @@ package net.F53.HorseBuff; -import net.F53.HorseBuff.utils.KeyInput; import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; -import net.minecraft.block.AbstractBlock; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.ingame.InventoryScreen; import net.minecraft.client.option.KeyBinding; import net.minecraft.client.util.InputUtil; -import net.minecraft.entity.passive.AbstractHorseEntity; import org.lwjgl.glfw.GLFW; public class ClientInit implements ClientModInitializer { - private boolean isInventoryOpened = false; - private KeyInput keyInput = new KeyInput(); - public static KeyBinding horsePlayerInventory = KeyBindingHelper.registerKeyBinding(new KeyBinding( "text.HorseBuff.keybinding.horsePlayerInventory", InputUtil.Type.KEYSYM, @@ -26,31 +17,6 @@ public class ClientInit implements ClientModInitializer { @Override public void onInitializeClient() { - ClientTickEvents.END_CLIENT_TICK.register(client -> { - openPlayerInventory(client); - }); - } - private void openPlayerInventory(MinecraftClient client) { - if(client.player == null) { - return; - } - if(!(client.player.getVehicle() instanceof AbstractHorseEntity)) { - return; - } - if(client.currentScreen == null) { - isInventoryOpened = false; - } - if(keyInput.isKeyReleased(client.getWindow().getHandle(), horsePlayerInventory)) { - if(!isInventoryOpened) { - if(client.currentScreen == null) { - client.setScreen(new InventoryScreen(client.player)); - isInventoryOpened = true; - } - } else { - client.setScreen(null); - isInventoryOpened = false; - } - } } } \ No newline at end of file diff --git a/src/main/java/net/F53/HorseBuff/mixin/Client/InventoryAccessor.java b/src/main/java/net/F53/HorseBuff/mixin/Client/InventoryAccessor.java index 28a3157..420e1bf 100644 --- a/src/main/java/net/F53/HorseBuff/mixin/Client/InventoryAccessor.java +++ b/src/main/java/net/F53/HorseBuff/mixin/Client/InventoryAccessor.java @@ -1,12 +1,12 @@ package net.F53.HorseBuff.mixin.Client; +import net.F53.HorseBuff.ClientInit; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ingame.InventoryScreen; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.tutorial.TutorialManager; import org.jetbrains.annotations.Nullable; -import org.lwjgl.glfw.GLFW; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -24,9 +24,7 @@ public abstract class InventoryAccessor { @Redirect(method= "handleInputEvents()V", at = @At(value = "INVOKE", target = "net/minecraft/client/network/ClientPlayerEntity.openRidingInventory ()V")) void playerInventoryAccess(ClientPlayerEntity instance) { assert this.player != null; - boolean leftControl = GLFW.glfwGetKey(MinecraftClient.getInstance().getWindow().getHandle(), GLFW.GLFW_KEY_LEFT_CONTROL) == 1; - boolean rightControl = GLFW.glfwGetKey(MinecraftClient.getInstance().getWindow().getHandle(), GLFW.GLFW_KEY_RIGHT_CONTROL) == 1; - if (leftControl || rightControl) { + if (ClientInit.horsePlayerInventory.isPressed()) { tutorialManager.onInventoryOpened(); setScreen(new InventoryScreen(this.player)); } else { diff --git a/src/main/java/net/F53/HorseBuff/utils/KeyInput.java b/src/main/java/net/F53/HorseBuff/utils/KeyInput.java deleted file mode 100644 index 51a8baf..0000000 --- a/src/main/java/net/F53/HorseBuff/utils/KeyInput.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.F53.HorseBuff.utils; - -import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; -import net.minecraft.client.option.KeyBinding; -import org.lwjgl.glfw.GLFW; - -public class KeyInput { - private boolean wasKeyPressed = false; - public boolean isKeyReleased(long window, KeyBinding key) { - if(GLFW.glfwGetKey(window, KeyBindingHelper.getBoundKeyOf(key).getCode()) == 1) { - wasKeyPressed = true; - } else { - if(wasKeyPressed) { - wasKeyPressed = false; - return true; - } - } - return false; - } -} From a3e70d238b4301ace570d1c622716066701a10eb Mon Sep 17 00:00:00 2001 From: Vipryx <114797944+VipCoder8@users.noreply.github.com> Date: Wed, 19 Mar 2025 14:18:48 +0300 Subject: [PATCH 4/5] Update HorseBuffInit.java Remove accidentally added unused import. --- src/main/java/net/F53/HorseBuff/HorseBuffInit.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/net/F53/HorseBuff/HorseBuffInit.java b/src/main/java/net/F53/HorseBuff/HorseBuffInit.java index 73fd62f..088b3f2 100644 --- a/src/main/java/net/F53/HorseBuff/HorseBuffInit.java +++ b/src/main/java/net/F53/HorseBuff/HorseBuffInit.java @@ -6,7 +6,6 @@ import net.F53.HorseBuff.config.ModConfig; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; -import net.minecraft.client.particle.RainSplashParticle; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.server.world.ServerWorld; From d5b84476e314927ada1fd0609d0604f45190548a Mon Sep 17 00:00:00 2001 From: VipCoder8 <114797944+VipCoder8@users.noreply.github.com> Date: Wed, 19 Mar 2025 16:57:38 +0300 Subject: [PATCH 5/5] Updated workflow. --- .github/workflows/build.yml | 10 +++++----- build.gradle | 4 ---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 036baf1..701ca55 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,18 +5,18 @@ jobs: build: strategy: matrix: - os: [ubuntu-20.04] + os: [ubuntu-22.04] runs-on: ${{ matrix.os }} steps: - name: checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: validate gradle wrapper - uses: gradle/wrapper-validation-action@v1 + uses: gradle/wrapper-validation-action@v2 - name: setup jdk ${{ matrix.java }} - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'adopt' - java-version: 17 + java-version: 21 - name: make gradle wrapper executable run: chmod +x ./gradlew - name: build diff --git a/build.gradle b/build.gradle index fd430d4..e32e711 100644 --- a/build.gradle +++ b/build.gradle @@ -39,10 +39,6 @@ dependencies { // Fabric API modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - modIncludeImplementation(fabricApi.module("fabric-api-base", project.fabric_version)) - modIncludeImplementation(fabricApi.module("fabric-rendering-data-attachment-v1", project.fabric_version)) - modIncludeImplementation(fabricApi.module("fabric-lifecycle-events-v1", project.fabric_version)) - modIncludeImplementation(fabricApi.module("fabric-registry-sync-v0", project.fabric_version)) // Cloth Config modIncludeImplementation("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}"){