Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

Commit f119a97

Browse files
authored
Merge pull request #88 from VipCoder8/1.20.1
Backported to 1.20.1
2 parents 55fbe69 + d3645cf commit f119a97

12 files changed

Lines changed: 114 additions & 53 deletions

File tree

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ jobs:
55
build:
66
strategy:
77
matrix:
8-
os: [ubuntu-20.04]
8+
os: [ubuntu-22.04]
99
runs-on: ${{ matrix.os }}
1010
steps:
1111
- name: checkout repository
12-
uses: actions/checkout@v3
12+
uses: actions/checkout@v4
1313
- name: validate gradle wrapper
14-
uses: gradle/wrapper-validation-action@v1
14+
uses: gradle/wrapper-validation-action@v2
1515
- name: setup jdk ${{ matrix.java }}
16-
uses: actions/setup-java@v3
16+
uses: actions/setup-java@v4
1717
with:
1818
distribution: 'adopt'
19-
java-version: 17
19+
java-version: 21
2020
- name: make gradle wrapper executable
2121
run: chmod +x ./gradlew
2222
- name: build

build.gradle

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'fabric-loom' version '0.11-SNAPSHOT'
2+
id 'fabric-loom' version '1.8-SNAPSHOT'
33
id 'maven-publish'
44
}
55

@@ -38,11 +38,7 @@ dependencies {
3838
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
3939

4040
// Fabric API
41-
//modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
42-
modIncludeImplementation(fabricApi.module("fabric-api-base", project.fabric_version))
43-
modIncludeImplementation(fabricApi.module("fabric-rendering-data-attachment-v1", project.fabric_version))
44-
modIncludeImplementation(fabricApi.module("fabric-lifecycle-events-v1", project.fabric_version))
45-
modIncludeImplementation(fabricApi.module("fabric-registry-sync-v0", project.fabric_version))
41+
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
4642

4743
// Cloth Config
4844
modIncludeImplementation("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}"){

gradle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ org.gradle.jvmargs=-Xmx1G
44

55
# Fabric Properties
66
# check these on https://fabricmc.net/develop/
7-
minecraft_version=1.20
8-
yarn_mappings=1.20+build.1
9-
loader_version=0.14.21
7+
minecraft_version=1.20.1
8+
yarn_mappings=1.20.1+build.10
9+
loader_version=0.16.10
1010

1111
# Mod Properties
1212
mod_version = 2.1.3
1313
maven_group = com.HorseBuff
1414
archives_base_name = HorseBuff
1515

1616
# Dependencies
17-
fabric_version=0.83.0+1.20
17+
fabric_version=0.92.3+1.20.1
1818
cloth_config_version=11.0.99
1919
mod_menu_version=7.0.1
2020
mixinextras_version=0.2.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package net.F53.HorseBuff;
2+
3+
import net.fabricmc.api.ClientModInitializer;
4+
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
5+
import net.minecraft.client.option.KeyBinding;
6+
import net.minecraft.client.util.InputUtil;
7+
import org.lwjgl.glfw.GLFW;
8+
9+
public class ClientInit implements ClientModInitializer {
10+
11+
public static KeyBinding horsePlayerInventory = KeyBindingHelper.registerKeyBinding(new KeyBinding(
12+
"text.HorseBuff.keybinding.horsePlayerInventory",
13+
InputUtil.Type.KEYSYM,
14+
GLFW.GLFW_KEY_LEFT_ALT,
15+
"text.HorseBuff.keybinding.category"
16+
));
17+
18+
@Override
19+
public void onInitializeClient() {
20+
21+
}
22+
}

src/main/java/net/F53/HorseBuff/config/ModConfig.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@ public class ModConfig implements ConfigData{
3535

3636
@ConfigEntry.Category("Client")
3737
@ConfigEntry.Gui.Tooltip
38-
public boolean swim = true;
38+
public boolean swimHorse = true;
39+
40+
@ConfigEntry.Category("Client")
41+
@ConfigEntry.Gui.Tooltip
42+
public boolean swimCamel = false;
43+
44+
@ConfigEntry.Category("Client")
45+
@ConfigEntry.Gui.Tooltip
46+
public boolean swimDead = false;
3947

4048
@ConfigEntry.Category("Client")
4149
@ConfigEntry.Gui.Tooltip

src/main/java/net/F53/HorseBuff/mixin/Client/InventoryAccessor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package net.F53.HorseBuff.mixin.Client;
22

3+
import net.F53.HorseBuff.ClientInit;
34
import net.minecraft.client.MinecraftClient;
45
import net.minecraft.client.gui.screen.Screen;
56
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
@@ -21,13 +22,12 @@ public abstract class InventoryAccessor {
2122
@Shadow @Nullable public ClientPlayerEntity player;
2223

2324
@Redirect(method= "handleInputEvents()V", at = @At(value = "INVOKE", target = "net/minecraft/client/network/ClientPlayerEntity.openRidingInventory ()V"))
24-
void playerInventoryAccess(ClientPlayerEntity instance){
25+
void playerInventoryAccess(ClientPlayerEntity instance) {
2526
assert this.player != null;
26-
if (MinecraftClient.getInstance().options.sprintKey.isPressed()) {
27+
if (ClientInit.horsePlayerInventory.isPressed()) {
2728
tutorialManager.onInventoryOpened();
2829
setScreen(new InventoryScreen(this.player));
29-
}
30-
else {
30+
} else {
3131
instance.openRidingInventory();
3232
}
3333
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package net.F53.HorseBuff.mixin.Client;
2+
3+
import net.F53.HorseBuff.config.ModConfig;
4+
import net.minecraft.entity.LivingEntity;
5+
import net.minecraft.entity.mob.SkeletonHorseEntity;
6+
import net.minecraft.entity.mob.ZombieHorseEntity;
7+
import net.minecraft.entity.passive.*;
8+
import net.minecraft.entity.player.PlayerEntity;
9+
import net.minecraft.registry.tag.FluidTags;
10+
import net.minecraft.util.math.Vec3d;
11+
import org.spongepowered.asm.mixin.Mixin;
12+
import org.spongepowered.asm.mixin.Unique;
13+
import org.spongepowered.asm.mixin.injection.At;
14+
import org.spongepowered.asm.mixin.injection.Inject;
15+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
16+
17+
@Mixin(value = LivingEntity.class)
18+
public class Swim {
19+
@Inject(method = "travelControlled", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;travel(Lnet/minecraft/util/math/Vec3d;)V", shift = At.Shift.BEFORE))
20+
private void fakeSwim(PlayerEntity controllingPlayer, Vec3d movementInput, CallbackInfo ci) {
21+
if (!((Object)this instanceof AbstractHorseEntity)) {return;}
22+
AbstractHorseEntity horseInstance = (AbstractHorseEntity) (Object) this;
23+
if (!shouldSwim(horseInstance)) {return;}
24+
25+
if (horseInstance.getFluidHeight(FluidTags.WATER) > horseInstance.getSwimHeight()) {
26+
horseInstance.addVelocity(0, 0.08, 0);
27+
}
28+
}
29+
30+
@Unique
31+
private boolean shouldSwim(AbstractHorseEntity horseInstance) {
32+
if (horseInstance instanceof HorseEntity ||
33+
horseInstance instanceof DonkeyEntity ||
34+
horseInstance instanceof MuleEntity) {
35+
return ModConfig.getInstance().swimHorse;
36+
}
37+
38+
if (horseInstance instanceof SkeletonHorseEntity ||
39+
horseInstance instanceof ZombieHorseEntity) {
40+
return ModConfig.getInstance().swimDead;
41+
}
42+
43+
if (horseInstance instanceof CamelEntity) {
44+
return ModConfig.getInstance().swimCamel;
45+
}
46+
47+
return false; // you should never be able to reach this, but if you do it defaults to vanilla behavior
48+
}
49+
}

src/main/java/net/F53/HorseBuff/mixin/Server/Swim.java

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/main/resources/assets/horsebuff/lang/en_us.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,14 @@
2727
"text.autoconfig.HorseBuff.option.noBuck": "Disable Random Bucking",
2828
"text.autoconfig.HorseBuff.option.noBuck.@Tooltip": "Yes - Prevents horses from randomly bucking while mounted, no more random stops!\nNo - vanilla behavior",
2929

30-
"text.autoconfig.HorseBuff.option.swim": "Horse Swimming",
31-
"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)",
30+
"text.autoconfig.HorseBuff.option.swimHorse": "Horse, Mules, and Donkeys Swim",
31+
"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)",
32+
33+
"text.autoconfig.HorseBuff.option.swimCamel": "Camels Swim",
34+
"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)",
35+
36+
"text.autoconfig.HorseBuff.option.swimDead": "Undead Horses Swim",
37+
"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)",
3238

3339
"text.autoconfig.HorseBuff.option.pitchFade": "Horse Fade",
3440
"text.autoconfig.HorseBuff.option.pitchFade.@Tooltip": "When mounted, the horse gets more transparent the further you look down",
@@ -48,5 +54,9 @@
4854
"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",
4955

5056
"text.autoconfig.HorseBuff.option.jeb_Horses": "jeb_ Horses",
51-
"text.autoconfig.HorseBuff.option.jeb_Horses.@Tooltip": "Like sheep, horses will become RGB when named \"jeb\""
57+
"text.autoconfig.HorseBuff.option.jeb_Horses.@Tooltip": "Like sheep, horses will become RGB when named \"jeb\"",
58+
59+
60+
"text.HorseBuff.keybinding.category": "Horse Buff",
61+
"text.HorseBuff.keybinding.horsePlayerInventory": "Open Inventory on Horse"
5262
}

0 commit comments

Comments
 (0)