version 0.0.8-hotfix

This commit is contained in:
LostInLinearPast 2025-11-12 17:45:45 +08:00
parent 64e45d3000
commit bff4a8bfdf
2 changed files with 4 additions and 6 deletions

View File

@ -27,6 +27,7 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.eventbus.api.IEventBus;
import org.jetbrains.annotations.Nullable;
@ -71,6 +72,7 @@ public class AnimationUtils {
return ANIMATION_RUNNER.testLoadedAndCall(() -> {
if(isAnimationLayerPresent(layer) && (animation == null || isAnimationPresent(animation))) {
if(player instanceof ServerPlayer serverPlayer) {
if(serverPlayer instanceof FakePlayer) return false;
return AnimationPlayer.serverPlayAnimation(serverPlayer, layer, animation);
}else if(player == null || player instanceof AbstractClientPlayer) {
AnimationPlayer.requestAnimationToServer((AbstractClientPlayer) player, layer, animation);
@ -119,10 +121,10 @@ public class AnimationUtils {
Animation anim = AnimationUtils.getAnimation(animation);
if(anim != null && anim.getRide() == null) return false;
if(serverPlayer != null) {
if(serverPlayer instanceof FakePlayer) return false;
if(serverPlayer.getVehicle() != null && force) serverPlayer.unRide();
else if(serverPlayer.getVehicle() != null) return false;
return AnimationPlayer.playAnimationWithRide(serverPlayer, layer, animation, true);
} else {
AnimationPlayer.requestAnimationRideToServer(layer, animation, force);
return true;

View File

@ -18,9 +18,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(Entity.class)
public abstract class MixinEntity {
@Shadow
private float eyeHeight;
@Shadow public abstract float getEyeHeight(Pose pPose);
@Shadow private AABB bb;
@ -46,8 +43,7 @@ public abstract class MixinEntity {
camYModifier = Math.min(camYModifier, animationCamY);
}
if(camYModifier != null){
this.eyeHeight = this.getEyeHeight(Pose.STANDING) + camYModifier;
cir.setReturnValue(this.eyeHeight);
cir.setReturnValue(this.getEyeHeight(Pose.STANDING) + camYModifier);
}
}
}