Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.
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
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 2 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.11-SNAPSHOT'
id 'fabric-loom' version '1.8-SNAPSHOT'
id 'maven-publish'
}

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

// 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))
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

// Cloth Config
modIncludeImplementation("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}"){
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ 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
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
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions src/main/java/net/F53/HorseBuff/ClientInit.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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_KEY_LEFT_ALT,
"text.HorseBuff.keybinding.category"
));

@Override
public void onInitializeClient() {

}
}
10 changes: 9 additions & 1 deletion src/main/java/net/F53/HorseBuff/config/ModConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
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;
Expand All @@ -21,13 +22,12 @@ 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()) {
if (ClientInit.horsePlayerInventory.isPressed()) {
tutorialManager.onInventoryOpened();
setScreen(new InventoryScreen(this.player));
}
else {
} else {
instance.openRidingInventory();
}
}
Expand Down
49 changes: 49 additions & 0 deletions src/main/java/net/F53/HorseBuff/mixin/Client/Swim.java
Original file line number Diff line number Diff line change
@@ -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
}
}
25 changes: 0 additions & 25 deletions src/main/java/net/F53/HorseBuff/mixin/Server/Swim.java

This file was deleted.

16 changes: 13 additions & 3 deletions src/main/resources/assets/horsebuff/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
3 changes: 2 additions & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
"environment": "*",
"entrypoints": {
"main": [ "net.F53.HorseBuff.HorseBuffInit" ],
"client": ["net.F53.HorseBuff.ClientInit"],
"modmenu": [ "net.F53.HorseBuff.config.ModMenuIntegration" ]
},
"mixins": [
"horsebuff.mixins.json"
],

"depends": {
"fabricloader": ">=0.14.6",
"fabricloader": ">=0.16.9",
"minecraft": ">=1.20 <1.20.2-",
"java": ">=17"
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/horsebuff.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
"Server.MovementCheck",
"Server.NoBuck",
"Server.NoWander",
"Server.StepHeight",
"Server.Swim"
"Server.StepHeight"
],
"client": [
"Client.HeadPitchOffset",
Expand All @@ -22,7 +21,8 @@
"Client.JebHorseTintable",
"Client.TransparentArmor",
"Client.TransparentLlamaDecor",
"Client.TransparentMarkings"
"Client.TransparentMarkings",
"Client.Swim"
],
"injectors": {
"defaultRequire": 1
Expand Down
Loading