generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from GirlInPurple/1.20
Update to 1.20.2 and add 2 new features
- Loading branch information
Showing
12 changed files
with
116 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.5-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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_KEY_LEFT_ALT, | ||
"text.HorseBuff.keybinding.category" | ||
)); | ||
|
||
@Override | ||
public void onInitializeClient() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters