From d9c659579ce5e8f92931248bf38fa58718ee4b87 Mon Sep 17 00:00:00 2001 From: The Color Blurple Date: Sun, 3 Dec 2023 20:14:42 -0500 Subject: [PATCH 1/9] Update to 1.20.2, add Inv Keybind --- README.md | 8 +++++--- build.gradle | 2 +- gradle.properties | 8 ++++---- .../java/net/F53/HorseBuff/ClientInit.java | 20 +++++++++++++++++++ .../net/F53/HorseBuff/config/ModConfig.java | 6 +++++- .../mixin/Client/InventoryAccessor.java | 3 ++- .../assets/horsebuff/lang/en_us.json | 6 +++++- src/main/resources/fabric.mod.json | 8 +++++--- 8 files changed, 47 insertions(+), 14 deletions(-) create mode 100644 src/main/java/net/F53/HorseBuff/ClientInit.java diff --git a/README.md b/README.md index 755a735..238871a 100644 --- a/README.md +++ b/README.md @@ -87,10 +87,12 @@ This prevents them from doing that. ![image](https://i.imgur.com/QTk8w33.gif) -
Sprint + Inventory to open survival inventory +
Hotkey to open survival inventory ![image](https://i.imgur.com/8oOswAR.png) - -*Horse Buff pulls from your Minecraft keybinds, so if you change your inventory/sprint key, that will change what you need to press to access your survival inventory +* Pre 1.20.2 + * Horse Buff pulls from your Minecraft keybinds, so if you change your inventory/sprint key, that will change what you need to press to access your survival inventory +* Post 1.20.2 + * A keybind for opening your inventory while on a horse has been added. Sprint + Inv (CTRL + E) is still the default, but you can change it now
diff --git a/build.gradle b/build.gradle index 3c17055..f6e7127 100644 --- a/build.gradle +++ b/build.gradle @@ -40,7 +40,7 @@ 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-rendering-data-attachment-v1", project.fabric_version)) // This tends to spit out errors, not sure why modIncludeImplementation(fabricApi.module("fabric-lifecycle-events-v1", project.fabric_version)) modIncludeImplementation(fabricApi.module("fabric-registry-sync-v0", project.fabric_version)) diff --git a/gradle.properties b/gradle.properties index 7f17c33..b7be186 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.2 +yarn_mappings=1.20.2+build.4 +loader_version=0.15.0 # 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.91.1+1.20.2 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/src/main/java/net/F53/HorseBuff/ClientInit.java b/src/main/java/net/F53/HorseBuff/ClientInit.java new file mode 100644 index 0000000..9547512 --- /dev/null +++ b/src/main/java/net/F53/HorseBuff/ClientInit.java @@ -0,0 +1,20 @@ +package net.F53.HorseBuff; + +import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; +import net.minecraft.client.option.KeyBinding; +import net.minecraft.client.util.InputUtil; +import org.lwjgl.glfw.GLFW; + +public class ClientInit implements ClientModInitializer { + + public static KeyBinding horsePlayerInventory = KeyBindingHelper.registerKeyBinding(new KeyBinding( + "text.HorseBuff.keybinding.horsePlayerInventory", + InputUtil.Type.KEYSYM, + GLFW.GLFW_MOD_CONTROL, + "text.HorseBuff.keybinding.category" + )); + + @Override + public void onInitializeClient() {} +} diff --git a/src/main/java/net/F53/HorseBuff/config/ModConfig.java b/src/main/java/net/F53/HorseBuff/config/ModConfig.java index 79127f0..1263644 100644 --- a/src/main/java/net/F53/HorseBuff/config/ModConfig.java +++ b/src/main/java/net/F53/HorseBuff/config/ModConfig.java @@ -33,10 +33,14 @@ public class ModConfig implements ConfigData{ @ConfigEntry.Gui.Tooltip public boolean noBuck = true; - @ConfigEntry.Category("Client") + @ConfigEntry.Category("Server") @ConfigEntry.Gui.Tooltip public boolean swim = true; + @ConfigEntry.Category("Server") + @ConfigEntry.Gui.Tooltip + public boolean undeadSwim = false; + @ConfigEntry.Category("Client") @ConfigEntry.Gui.Tooltip @ConfigEntry.Gui.CollapsibleObject 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..02e5340 100644 --- a/src/main/java/net/F53/HorseBuff/mixin/Client/InventoryAccessor.java +++ b/src/main/java/net/F53/HorseBuff/mixin/Client/InventoryAccessor.java @@ -11,6 +11,7 @@ import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; +import net.F53.HorseBuff.ClientInit; @Mixin(value = MinecraftClient.class, priority = 960) public abstract class InventoryAccessor { @@ -23,7 +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; - if (MinecraftClient.getInstance().options.sprintKey.isPressed()) { + if (ClientInit.horsePlayerInventory.isPressed()) { tutorialManager.onInventoryOpened(); setScreen(new InventoryScreen(this.player)); } diff --git a/src/main/resources/assets/horsebuff/lang/en_us.json b/src/main/resources/assets/horsebuff/lang/en_us.json index 7f07f41..d046077 100644 --- a/src/main/resources/assets/horsebuff/lang/en_us.json +++ b/src/main/resources/assets/horsebuff/lang/en_us.json @@ -48,5 +48,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..aa82df1 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,8 +29,9 @@ ], "depends": { - "fabricloader": ">=0.14.6", - "minecraft": ">=1.20 <1.20.2-", - "java": ">=17" + "fabricloader": ">=0.15.0", + "minecraft": ">=1.20.2", + "java": ">=17", + "fabric-key-binding-api-v1": "*" } } From 66a912525ca16a7138bd116e17193173208e5ec5 Mon Sep 17 00:00:00 2001 From: The Color Blurple Date: Sun, 3 Dec 2023 21:14:53 -0500 Subject: [PATCH 2/9] Add ability to block swimming to certain mobs --- README.md | 4 ++- .../net/F53/HorseBuff/config/ModConfig.java | 8 +++-- .../net/F53/HorseBuff/mixin/Server/Swim.java | 34 ++++++++++++++++--- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 238871a..d7be151 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,9 @@ This makes riding horses around path blocks way less frustrating.
Allow swimming while Mounted Normally Horses will sink in water when you are riding them.\ -This makes you float on the surface as if they weren't mounted +This makes you float on the surface as if they weren't mounted.\ +The default configs turn this ability off for skeleton and zombie horses, and camels.\ +Have you ever seen a camel swim? i think not!
diff --git a/src/main/java/net/F53/HorseBuff/config/ModConfig.java b/src/main/java/net/F53/HorseBuff/config/ModConfig.java index 1263644..02f9938 100644 --- a/src/main/java/net/F53/HorseBuff/config/ModConfig.java +++ b/src/main/java/net/F53/HorseBuff/config/ModConfig.java @@ -35,11 +35,15 @@ public class ModConfig implements ConfigData{ @ConfigEntry.Category("Server") @ConfigEntry.Gui.Tooltip - public boolean swim = true; + public boolean swimHorse = true; @ConfigEntry.Category("Server") @ConfigEntry.Gui.Tooltip - public boolean undeadSwim = false; + public boolean swimCamel = false; + + @ConfigEntry.Category("Server") + @ConfigEntry.Gui.Tooltip + public boolean swimDead = false; @ConfigEntry.Category("Client") @ConfigEntry.Gui.Tooltip diff --git a/src/main/java/net/F53/HorseBuff/mixin/Server/Swim.java b/src/main/java/net/F53/HorseBuff/mixin/Server/Swim.java index faee91e..81f9428 100644 --- a/src/main/java/net/F53/HorseBuff/mixin/Server/Swim.java +++ b/src/main/java/net/F53/HorseBuff/mixin/Server/Swim.java @@ -2,11 +2,14 @@ import net.F53.HorseBuff.config.ModConfig; import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.passive.AbstractHorseEntity; +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; @@ -15,11 +18,32 @@ 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); + AbstractHorseEntity horseEntity = (AbstractHorseEntity) (Object) this; + + if (shouldSwim(horseEntity)) { + if (horseEntity.getFluidHeight(FluidTags.WATER) > horseEntity.getSwimHeight()) { + horseEntity.addVelocity(0, 0.08, 0); } } } + + @Unique + private boolean shouldSwim(AbstractHorseEntity horseEntity) { + if (horseEntity instanceof HorseEntity) { + return ModConfig.getInstance().swimHorse; + } else if (horseEntity instanceof MuleEntity) { + return ModConfig.getInstance().swimHorse; + } else if (horseEntity instanceof DonkeyEntity) { + return ModConfig.getInstance().swimHorse; + + } else if (horseEntity instanceof CamelEntity) { + return ModConfig.getInstance().swimCamel; + + } else if (horseEntity instanceof SkeletonHorseEntity) { + return ModConfig.getInstance().swimDead; + } else if (horseEntity instanceof ZombieHorseEntity) { + return ModConfig.getInstance().swimDead; + } + return false; + } } From 237d7835fe67514d048d0fa467c6408fba08f910 Mon Sep 17 00:00:00 2001 From: The Color Blurple Date: Sun, 3 Dec 2023 22:57:49 -0500 Subject: [PATCH 3/9] fixed en_us translations, changed ctrl to alt, fixed weird modmenu crash --- gradle.properties | 4 ++-- src/main/java/net/F53/HorseBuff/ClientInit.java | 2 +- src/main/resources/assets/horsebuff/lang/en_us.json | 10 ++++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index b7be186..01c2b4a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,6 +15,6 @@ archives_base_name = HorseBuff # Dependencies fabric_version=0.91.1+1.20.2 -cloth_config_version=11.0.99 -mod_menu_version=7.0.1 +cloth_config_version=12.0.111 +mod_menu_version=8.0.0 mixinextras_version=0.2.0 \ No newline at end of file diff --git a/src/main/java/net/F53/HorseBuff/ClientInit.java b/src/main/java/net/F53/HorseBuff/ClientInit.java index 9547512..4e397e2 100644 --- a/src/main/java/net/F53/HorseBuff/ClientInit.java +++ b/src/main/java/net/F53/HorseBuff/ClientInit.java @@ -11,7 +11,7 @@ public class ClientInit implements ClientModInitializer { public static KeyBinding horsePlayerInventory = KeyBindingHelper.registerKeyBinding(new KeyBinding( "text.HorseBuff.keybinding.horsePlayerInventory", InputUtil.Type.KEYSYM, - GLFW.GLFW_MOD_CONTROL, + GLFW.GLFW_MOD_ALT, "text.HorseBuff.keybinding.category" )); diff --git a/src/main/resources/assets/horsebuff/lang/en_us.json b/src/main/resources/assets/horsebuff/lang/en_us.json index d046077..bb8b02c 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": "Horse, Mules, and Donkeys 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", From ed887da9eb9ab022d35c647cb175e48b4464d1ef Mon Sep 17 00:00:00 2001 From: The Color Blurple Date: Sun, 3 Dec 2023 23:02:50 -0500 Subject: [PATCH 4/9] update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d7be151..e6966a4 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ This makes riding horses around path blocks way less frustrating. Normally Horses will sink in water when you are riding them.\ This makes you float on the surface as if they weren't mounted.\ The default configs turn this ability off for skeleton and zombie horses, and camels.\ -Have you ever seen a camel swim? i think not! +Have you ever seen a camel swim? I think not!
@@ -95,6 +95,6 @@ This prevents them from doing that. * Pre 1.20.2 * Horse Buff pulls from your Minecraft keybinds, so if you change your inventory/sprint key, that will change what you need to press to access your survival inventory * Post 1.20.2 - * A keybind for opening your inventory while on a horse has been added. Sprint + Inv (CTRL + E) is still the default, but you can change it now + * A keybind for opening your inventory while on a horse has been added. ALT + Inv (ALT + E) is now the default, but you can change it to whatever you like From 08ae9b5e3396e35f469c2a2c5da50f0c06af3d6d Mon Sep 17 00:00:00 2001 From: The Color Blurple Date: Mon, 4 Dec 2023 15:39:48 -0500 Subject: [PATCH 5/9] make requested changes, update loom and gradle --- build.gradle | 7 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- .../net/F53/HorseBuff/config/ModConfig.java | 6 ++-- .../net/F53/HorseBuff/mixin/Server/Swim.java | 36 +++++++++---------- src/main/resources/fabric.mod.json | 5 ++- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/build.gradle b/build.gradle index f6e7127..a9a5c9a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.11-SNAPSHOT' + id 'fabric-loom' version '1.4-SNAPSHOT' id 'maven-publish' } @@ -38,11 +38,12 @@ 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)) // This tends to spit out errors, not sure why + 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)) + modIncludeImplementation(fabricApi.module("fabric-key-binding-api-v1", project.fabric_version)) // Cloth Config modIncludeImplementation("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}"){ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ffed3a2..a595206 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.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/net/F53/HorseBuff/config/ModConfig.java b/src/main/java/net/F53/HorseBuff/config/ModConfig.java index 02f9938..4016336 100644 --- a/src/main/java/net/F53/HorseBuff/config/ModConfig.java +++ b/src/main/java/net/F53/HorseBuff/config/ModConfig.java @@ -33,15 +33,15 @@ public class ModConfig implements ConfigData{ @ConfigEntry.Gui.Tooltip public boolean noBuck = true; - @ConfigEntry.Category("Server") + @ConfigEntry.Category("Client") @ConfigEntry.Gui.Tooltip public boolean swimHorse = true; - @ConfigEntry.Category("Server") + @ConfigEntry.Category("Client") @ConfigEntry.Gui.Tooltip public boolean swimCamel = false; - @ConfigEntry.Category("Server") + @ConfigEntry.Category("Client") @ConfigEntry.Gui.Tooltip public boolean swimDead = false; diff --git a/src/main/java/net/F53/HorseBuff/mixin/Server/Swim.java b/src/main/java/net/F53/HorseBuff/mixin/Server/Swim.java index 81f9428..24fe3b4 100644 --- a/src/main/java/net/F53/HorseBuff/mixin/Server/Swim.java +++ b/src/main/java/net/F53/HorseBuff/mixin/Server/Swim.java @@ -18,32 +18,32 @@ 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) { - AbstractHorseEntity horseEntity = (AbstractHorseEntity) (Object) this; + if (!((Object)this instanceof AbstractHorseEntity)) {return;} + AbstractHorseEntity horseInstance = (AbstractHorseEntity) (Object) this; + if (!shouldSwim(horseInstance)) {return;} - if (shouldSwim(horseEntity)) { - if (horseEntity.getFluidHeight(FluidTags.WATER) > horseEntity.getSwimHeight()) { - horseEntity.addVelocity(0, 0.08, 0); - } + if (horseInstance.getFluidHeight(FluidTags.WATER) > horseInstance.getSwimHeight()) { + horseInstance.addVelocity(0, 0.08, 0); } } @Unique - private boolean shouldSwim(AbstractHorseEntity horseEntity) { - if (horseEntity instanceof HorseEntity) { + private boolean shouldSwim(AbstractHorseEntity horseInstance) { + if (horseInstance instanceof HorseEntity || + horseInstance instanceof DonkeyEntity || + horseInstance instanceof MuleEntity) { return ModConfig.getInstance().swimHorse; - } else if (horseEntity instanceof MuleEntity) { - return ModConfig.getInstance().swimHorse; - } else if (horseEntity instanceof DonkeyEntity) { - return ModConfig.getInstance().swimHorse; - - } else if (horseEntity instanceof CamelEntity) { - return ModConfig.getInstance().swimCamel; + } - } else if (horseEntity instanceof SkeletonHorseEntity) { - return ModConfig.getInstance().swimDead; - } else if (horseEntity instanceof ZombieHorseEntity) { + if (horseInstance instanceof SkeletonHorseEntity || + horseInstance instanceof ZombieHorseEntity) { return ModConfig.getInstance().swimDead; } - return false; + + 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 } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index aa82df1..ffdaf9d 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -29,9 +29,8 @@ ], "depends": { - "fabricloader": ">=0.15.0", + "fabricloader": ">=0.14.23", "minecraft": ">=1.20.2", - "java": ">=17", - "fabric-key-binding-api-v1": "*" + "java": ">=17" } } From 53775ac8bf5fc01e9503fc72216fc442d462cce4 Mon Sep 17 00:00:00 2001 From: The Color Blurple Date: Mon, 4 Dec 2023 17:00:21 -0500 Subject: [PATCH 6/9] clarify which side the mixin is on --- src/main/java/net/F53/HorseBuff/config/ModConfig.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/F53/HorseBuff/config/ModConfig.java b/src/main/java/net/F53/HorseBuff/config/ModConfig.java index 4016336..02f9938 100644 --- a/src/main/java/net/F53/HorseBuff/config/ModConfig.java +++ b/src/main/java/net/F53/HorseBuff/config/ModConfig.java @@ -33,15 +33,15 @@ public class ModConfig implements ConfigData{ @ConfigEntry.Gui.Tooltip public boolean noBuck = true; - @ConfigEntry.Category("Client") + @ConfigEntry.Category("Server") @ConfigEntry.Gui.Tooltip public boolean swimHorse = true; - @ConfigEntry.Category("Client") + @ConfigEntry.Category("Server") @ConfigEntry.Gui.Tooltip public boolean swimCamel = false; - @ConfigEntry.Category("Client") + @ConfigEntry.Category("Server") @ConfigEntry.Gui.Tooltip public boolean swimDead = false; From 990a1ecb30b0b8d78abba3054f0b66b18b31aeff Mon Sep 17 00:00:00 2001 From: The Color Blurple Date: Mon, 4 Dec 2023 17:32:34 -0500 Subject: [PATCH 7/9] client side it is --- .../net/F53/HorseBuff/config/ModConfig.java | 6 +- .../mixin/{Server => Client}/Swim.java | 98 +++++++++---------- src/main/resources/horsebuff.mixins.json | 4 +- 3 files changed, 54 insertions(+), 54 deletions(-) rename src/main/java/net/F53/HorseBuff/mixin/{Server => Client}/Swim.java (95%) diff --git a/src/main/java/net/F53/HorseBuff/config/ModConfig.java b/src/main/java/net/F53/HorseBuff/config/ModConfig.java index 02f9938..4016336 100644 --- a/src/main/java/net/F53/HorseBuff/config/ModConfig.java +++ b/src/main/java/net/F53/HorseBuff/config/ModConfig.java @@ -33,15 +33,15 @@ public class ModConfig implements ConfigData{ @ConfigEntry.Gui.Tooltip public boolean noBuck = true; - @ConfigEntry.Category("Server") + @ConfigEntry.Category("Client") @ConfigEntry.Gui.Tooltip public boolean swimHorse = true; - @ConfigEntry.Category("Server") + @ConfigEntry.Category("Client") @ConfigEntry.Gui.Tooltip public boolean swimCamel = false; - @ConfigEntry.Category("Server") + @ConfigEntry.Category("Client") @ConfigEntry.Gui.Tooltip public boolean swimDead = false; diff --git a/src/main/java/net/F53/HorseBuff/mixin/Server/Swim.java b/src/main/java/net/F53/HorseBuff/mixin/Client/Swim.java similarity index 95% rename from src/main/java/net/F53/HorseBuff/mixin/Server/Swim.java rename to src/main/java/net/F53/HorseBuff/mixin/Client/Swim.java index 24fe3b4..2bdf5fb 100644 --- a/src/main/java/net/F53/HorseBuff/mixin/Server/Swim.java +++ b/src/main/java/net/F53/HorseBuff/mixin/Client/Swim.java @@ -1,49 +1,49 @@ -package net.F53.HorseBuff.mixin.Server; - -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 - } -} +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 + } +} diff --git a/src/main/resources/horsebuff.mixins.json b/src/main/resources/horsebuff.mixins.json index 2d7d8b4..05dc5a5 100644 --- a/src/main/resources/horsebuff.mixins.json +++ b/src/main/resources/horsebuff.mixins.json @@ -12,14 +12,14 @@ "Server.MovementCheck", "Server.NoBuck", "Server.NoWander", - "Server.StepHeight", - "Server.Swim" + "Server.StepHeight" ], "client": [ "Client.HeadPitchOffset", "Client.HorseRenderer", "Client.InventoryAccessor", "Client.JebHorseTintable", + "Client.Swim", "Client.TransparentArmor", "Client.TransparentLlamaDecor", "Client.TransparentMarkings" From eeeb72d3f84136115cea748617521e63429747fd Mon Sep 17 00:00:00 2001 From: The Color Blurple Date: Mon, 4 Dec 2023 18:20:15 -0500 Subject: [PATCH 8/9] wording and hotkey fix --- README.md | 2 +- src/main/java/net/F53/HorseBuff/ClientInit.java | 2 +- src/main/resources/assets/horsebuff/lang/en_us.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e6966a4..bfff51d 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ This makes riding horses around path blocks way less frustrating. Normally Horses will sink in water when you are riding them.\ This makes you float on the surface as if they weren't mounted.\ -The default configs turn this ability off for skeleton and zombie horses, and camels.\ +The default configs turns this ability off for skeleton and zombie horses, and camels.\ Have you ever seen a camel swim? I think not! diff --git a/src/main/java/net/F53/HorseBuff/ClientInit.java b/src/main/java/net/F53/HorseBuff/ClientInit.java index 4e397e2..1cf37af 100644 --- a/src/main/java/net/F53/HorseBuff/ClientInit.java +++ b/src/main/java/net/F53/HorseBuff/ClientInit.java @@ -11,7 +11,7 @@ public class ClientInit implements ClientModInitializer { public static KeyBinding horsePlayerInventory = KeyBindingHelper.registerKeyBinding(new KeyBinding( "text.HorseBuff.keybinding.horsePlayerInventory", InputUtil.Type.KEYSYM, - GLFW.GLFW_MOD_ALT, + GLFW.GLFW_KEY_LEFT_ALT, "text.HorseBuff.keybinding.category" )); diff --git a/src/main/resources/assets/horsebuff/lang/en_us.json b/src/main/resources/assets/horsebuff/lang/en_us.json index bb8b02c..32a7eca 100644 --- a/src/main/resources/assets/horsebuff/lang/en_us.json +++ b/src/main/resources/assets/horsebuff/lang/en_us.json @@ -33,7 +33,7 @@ "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": "Horse, Mules, and Donkeys Swim", + "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", From 883176f9238d966576cda17533d2e1c54a5406f5 Mon Sep 17 00:00:00 2001 From: The Color Blurple Date: Mon, 4 Dec 2023 18:24:42 -0500 Subject: [PATCH 9/9] wording --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bfff51d..efbe25f 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ This makes riding horses around path blocks way less frustrating. Normally Horses will sink in water when you are riding them.\ This makes you float on the surface as if they weren't mounted.\ -The default configs turns this ability off for skeleton and zombie horses, and camels.\ +The default config turns this ability off for skeleton and zombie horses, and camels.\ Have you ever seen a camel swim? I think not!