Skip to content

Commit

Permalink
Fix copy stack + fishing rod related stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixces committed Jan 21, 2025
1 parent cbb0904 commit 337719e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ modmenu_version=13.0.0
yacl_version=3.6.2+1.21.4-fabric

# Mod Properties
mod_version=1.0.0-dev-38
mod_version=1.0.0-dev-39
maven_group=btw.mixces
archives_base_name=animatium
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ protected MixinFishingHookRenderer(EntityRendererProvider.Context context) {
float eyeHeight;
if (AnimatiumConfig.instance().getFishingRodLineInterpolation()) {
eyeHeight = Mth.lerp(v, cameraAccessor.getEyeHeightOld(), cameraAccessor.getEyeHeight());
} else if (AnimatiumClient.getEnabled() && AnimatiumConfig.instance().getFakeOldSneakEyeHeight()) {
} else if (AnimatiumConfig.instance().getFakeOldSneakEyeHeight()) {
// Non-lerped eyeheight trick
eyeHeight = cameraAccessor.getEyeHeight();
} else {
return originalPos;
}

return PlayerUtils.lerpPlayerWithEyeHeight(instance, v, eyeHeight);
return PlayerUtils.getPosWithEyeHeight(instance, v, eyeHeight);
} else {
return originalPos;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,17 @@ public abstract class MixinItemInHandRenderer {
return (!AnimatiumClient.getEnabled() || !AnimatiumConfig.instance().getShowHeldItemInBoat()) && original.call(instance);
}

@WrapOperation(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;getMainHandItem()Lnet/minecraft/world/item/ItemStack;"))
private ItemStack animatium$fixCopyStack(LocalPlayer instance, Operation<ItemStack> original) {
ItemStack originalStack = original.call(instance);
if (AnimatiumClient.getEnabled() && AnimatiumConfig.instance().getFixEquipAnimationItemCheck() && original.call(instance).isEmpty()) {
// Update the stack to match mutations to the stack in other classes
return originalStack.copy();
} else {
return originalStack;
}
}

@WrapOperation(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/ItemInHandRenderer;shouldInstantlyReplaceVisibleItem(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/item/ItemStack;)Z"))
private boolean animatium$fixEquipAnimationItemCheck(ItemInHandRenderer instance, ItemStack itemStack, ItemStack itemStack2, Operation<Boolean> original, @Local LocalPlayer localPlayer, @Local(ordinal = 0) ItemStack mainHandItem) {
boolean value = original.call(instance, itemStack, itemStack2);
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/btw/mixces/animatium/AnimatiumClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AnimatiumClient : ClientModInitializer {

// Info
const val VERSION = 1.0
val DEVELOPMENT_VERSION = Optional.ofNullable(38)
val DEVELOPMENT_VERSION = Optional.ofNullable(39)

@JvmStatic
fun getInfoPayload(): AnimatiumInfoPayloadPacket {
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/btw/mixces/animatium/util/PlayerUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ object PlayerUtils {
}

@JvmStatic
fun lerpPlayerWithEyeHeight(entity: Player, tickDelta: Float, eyeHeight: Double): Vec3 {
fun getPosWithEyeHeight(entity: Player, tickDelta: Float, eyeHeight: Double): Vec3 {
return entity.getPosition(tickDelta).add(0.0, eyeHeight, 0.0)
}

Expand Down

0 comments on commit 337719e

Please sign in to comment.