Skip to content

Commit

Permalink
fix cape with balloon cart holding anim
Browse files Browse the repository at this point in the history
  • Loading branch information
maximumpower55 committed Jul 8, 2024
1 parent f6a957f commit f1e0eed
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package one.devos.nautical.up_and_away.framework.ext;

public interface HumanoidModelExt {
boolean up_and_away$holdingBalloonCart();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package one.devos.nautical.up_and_away.mixin.client;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;

import net.minecraft.client.model.PlayerModel;
import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.client.renderer.entity.RenderLayerParent;
import net.minecraft.client.renderer.entity.layers.CapeLayer;

import net.minecraft.client.renderer.entity.layers.RenderLayer;

import one.devos.nautical.up_and_away.framework.ext.HumanoidModelExt;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(CapeLayer.class)
public abstract class CapeLayerMixin extends RenderLayer<AbstractClientPlayer, PlayerModel<AbstractClientPlayer>> {
private CapeLayerMixin(RenderLayerParent<AbstractClientPlayer, PlayerModel<AbstractClientPlayer>> context) {
super(context);
}

@ModifyExpressionValue(
method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/client/player/AbstractClientPlayer;FFFFFF)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/player/AbstractClientPlayer;isCrouching()Z"
)
)
private boolean balloonCartExtraCrouch(boolean original) {
return original || ((HumanoidModelExt) this.getParentModel()).up_and_away$holdingBalloonCart();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

import one.devos.nautical.up_and_away.content.UpAndAwayItems;

import one.devos.nautical.up_and_away.framework.ext.HumanoidModelExt;

import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand All @@ -19,7 +21,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(HumanoidModel.class)
public class HumanoidModelMixin {
public class HumanoidModelMixin implements HumanoidModelExt {
@Shadow
@Final
public ModelPart rightArm;
Expand All @@ -34,6 +36,11 @@ public class HumanoidModelMixin {
@Unique
private boolean holdingBalloonCart;

@Override
public boolean up_and_away$holdingBalloonCart() {
return this.holdingBalloonCart;
}

@Inject(method = "setupAnim(Lnet/minecraft/world/entity/LivingEntity;FFFFF)V", at = @At("HEAD"))
private void balloonCartHoldingAnim(
LivingEntity entity,
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/up_and_away.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"ShulkerBulletAccessor"
],
"client": [
"client.CapeLayerMixin",
"client.HumanoidModelMixin",
"client.ItemInHandLayerMixin",
"client.ItemInHandRendererMixin"
Expand Down

0 comments on commit f1e0eed

Please sign in to comment.