diff options
author | inglettronald <inglettronald@gmail.com> | 2023-07-19 10:34:12 -0500 |
---|---|---|
committer | inglettronald <inglettronald@gmail.com> | 2023-07-19 10:34:12 -0500 |
commit | 261370d3539579b23f3cf07733d310e9ff35becb (patch) | |
tree | 799742697b26243d376a0b9030c909446e0b377c /src/main/java | |
parent | 306e32869357f2151d733a6b11e547b676d06954 (diff) | |
download | DulkirMod-Fabric-261370d3539579b23f3cf07733d310e9ff35becb.tar.gz DulkirMod-Fabric-261370d3539579b23f3cf07733d310e9ff35becb.tar.bz2 DulkirMod-Fabric-261370d3539579b23f3cf07733d310e9ff35becb.zip |
working on some polish for animations code
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/dulkirfabric/mixin/render/HeldItemRendererMixin.java | 24 | ||||
-rw-r--r-- | src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java | 7 |
2 files changed, 24 insertions, 7 deletions
diff --git a/src/main/java/com/dulkirfabric/mixin/render/HeldItemRendererMixin.java b/src/main/java/com/dulkirfabric/mixin/render/HeldItemRendererMixin.java index f0e6422..b785b59 100644 --- a/src/main/java/com/dulkirfabric/mixin/render/HeldItemRendererMixin.java +++ b/src/main/java/com/dulkirfabric/mixin/render/HeldItemRendererMixin.java @@ -8,6 +8,7 @@ import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.item.HeldItemRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; +import net.minecraft.util.Arm; import net.minecraft.util.Hand; import net.minecraft.util.math.RotationAxis; import org.spongepowered.asm.mixin.Mixin; @@ -34,17 +35,17 @@ public abstract class HeldItemRendererMixin { float rotY = DulkirConfig.ConfigVars.getConfigOptions().getHeldItemRotY(); float rotZ = DulkirConfig.ConfigVars.getConfigOptions().getHeldItemRotZ(); - float posX = DulkirConfig.ConfigVars.getConfigOptions().getHeldItemPosX() / 1000f; - float posY = DulkirConfig.ConfigVars.getConfigOptions().getHeldItemPosY() / 1000f; - float posZ = DulkirConfig.ConfigVars.getConfigOptions().getHeldItemPosZ() / 1000f; + float posX = DulkirConfig.ConfigVars.getConfigOptions().getHeldItemPosX() / 100f; + float posY = DulkirConfig.ConfigVars.getConfigOptions().getHeldItemPosY() / 100f; + float posZ = DulkirConfig.ConfigVars.getConfigOptions().getHeldItemPosZ() / 100f; float scale = DulkirConfig.ConfigVars.getConfigOptions().getHeldItemScale(); + matrices.translate(posX, posY, posZ); - matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(rotX)); - matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(rotY)); - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(rotZ)); + matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(rotX)); + matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(rotY)); + matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(rotZ)); matrices.scale(scale, scale, scale); - matrices.translate(posX, posY, posZ); } } @@ -57,4 +58,13 @@ public abstract class HeldItemRendererMixin { public float attackCooldown(float original) { return 1f; } + + @Inject(method = "applyEquipOffset", at = @At("HEAD"), cancellable = true) + public void onApplyEquipOffset(MatrixStack matrices, Arm arm, float equipProgress, CallbackInfo ci) { + if (DulkirConfig.ConfigVars.getConfigOptions().getCancelReEquip()) { + int i = arm == Arm.RIGHT ? 1 : -1; + matrices.translate((float)i * 0.56f, -0.52f, -0.72f); + ci.cancel(); + } + } } diff --git a/src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java b/src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java index c50f132..3a7c9ba 100644 --- a/src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java +++ b/src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java @@ -38,4 +38,11 @@ public class InGameHudMixin { } return original; } + + @ModifyExpressionValue(method = "renderStatusBars(Lnet/minecraft/client/gui/DrawContext;)V", + at = @At(value = "INVOKE", + target = "Lnet/minecraft/client/gui/hud/InGameHud;getHeartCount(Lnet/minecraft/entity/LivingEntity;)I")) + public int onCheckForRiding(int original) { + return 0; + } } |