diff options
author | inglettronald <inglettronald@gmail.com> | 2023-07-21 12:33:17 -0500 |
---|---|---|
committer | inglettronald <inglettronald@gmail.com> | 2023-07-21 12:33:17 -0500 |
commit | 36f717189486b740c8d196cedc2def7ac1625c22 (patch) | |
tree | fd48e9ab94f0ca65783230f204c69682a583f2f7 /src/main/java/com | |
parent | ad41c31385a66438b6647cd489e4ffb018950264 (diff) | |
download | DulkirMod-Fabric-36f717189486b740c8d196cedc2def7ac1625c22.tar.gz DulkirMod-Fabric-36f717189486b740c8d196cedc2def7ac1625c22.tar.bz2 DulkirMod-Fabric-36f717189486b740c8d196cedc2def7ac1625c22.zip |
bugfix
Diffstat (limited to 'src/main/java/com')
-rw-r--r-- | src/main/java/com/dulkirfabric/mixin/render/HeldItemRendererMixin.java | 26 | ||||
-rw-r--r-- | src/main/java/com/dulkirfabric/mixin/render/LivingEntityMixin.java | 7 |
2 files changed, 21 insertions, 12 deletions
diff --git a/src/main/java/com/dulkirfabric/mixin/render/HeldItemRendererMixin.java b/src/main/java/com/dulkirfabric/mixin/render/HeldItemRendererMixin.java index b785b59..1d1e80c 100644 --- a/src/main/java/com/dulkirfabric/mixin/render/HeldItemRendererMixin.java +++ b/src/main/java/com/dulkirfabric/mixin/render/HeldItemRendererMixin.java @@ -11,6 +11,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.Arm; import net.minecraft.util.Hand; import net.minecraft.util.math.RotationAxis; +import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -31,15 +32,14 @@ public abstract class HeldItemRendererMixin { at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V")) public void onRenderHeldItem(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { if (hand == Hand.MAIN_HAND) { - float rotX = DulkirConfig.ConfigVars.getConfigOptions().getHeldItemRotX(); - float rotY = DulkirConfig.ConfigVars.getConfigOptions().getHeldItemRotY(); - float rotZ = DulkirConfig.ConfigVars.getConfigOptions().getHeldItemRotZ(); + float rotX = DulkirConfig.ConfigVars.getConfigOptions().getAnimationPreset().getRotX(); + float rotY = DulkirConfig.ConfigVars.getConfigOptions().getAnimationPreset().getRotY(); + float rotZ = DulkirConfig.ConfigVars.getConfigOptions().getAnimationPreset().getRotZ(); + float posX = DulkirConfig.ConfigVars.getConfigOptions().getAnimationPreset().getPosX() / 100f; + float posY = DulkirConfig.ConfigVars.getConfigOptions().getAnimationPreset().getPosY() / 100f; + float posZ = DulkirConfig.ConfigVars.getConfigOptions().getAnimationPreset().getPosZ() / 100f; - 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(); + float scale = DulkirConfig.ConfigVars.getConfigOptions().getAnimationPreset().getScale(); matrices.translate(posX, posY, posZ); matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(rotX)); @@ -61,10 +61,18 @@ public abstract class HeldItemRendererMixin { @Inject(method = "applyEquipOffset", at = @At("HEAD"), cancellable = true) public void onApplyEquipOffset(MatrixStack matrices, Arm arm, float equipProgress, CallbackInfo ci) { - if (DulkirConfig.ConfigVars.getConfigOptions().getCancelReEquip()) { + if (DulkirConfig.ConfigVars.getConfigOptions().getAnimationPreset().getCancelReEquip()) { int i = arm == Arm.RIGHT ? 1 : -1; matrices.translate((float)i * 0.56f, -0.52f, -0.72f); ci.cancel(); } } + + @Inject(method = "applyEatOrDrinkTransformation", at = @At(value = "INVOKE", + target = "Ljava/lang/Math;pow(DD)D", shift = At.Shift.BEFORE), + cancellable = true + ) + public void onDrink(MatrixStack matrices, float tickDelta, Arm arm, ItemStack stack, CallbackInfo ci) { + ci.cancel(); + } } diff --git a/src/main/java/com/dulkirfabric/mixin/render/LivingEntityMixin.java b/src/main/java/com/dulkirfabric/mixin/render/LivingEntityMixin.java index c0f9a03..b615136 100644 --- a/src/main/java/com/dulkirfabric/mixin/render/LivingEntityMixin.java +++ b/src/main/java/com/dulkirfabric/mixin/render/LivingEntityMixin.java @@ -59,14 +59,15 @@ public class LivingEntityMixin implements GlowingEntityInterface { @Inject(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;tickNewAi()V", shift = At.Shift.AFTER)) public void onWhatever(CallbackInfo ci) { - if (DulkirConfig.ConfigVars.getConfigOptions().getHandSwingDuration() == 6) return; - if (animationTicks > DulkirConfig.ConfigVars.getConfigOptions().getHandSwingDuration()) { + if (DulkirConfig.ConfigVars.getConfigOptions().getAnimationPreset().getSwingDuration() == 6) return; + if (animationTicks > DulkirConfig.ConfigVars.getConfigOptions().getAnimationPreset().getSwingDuration()) { animationTicks = 0; } if (animationTicks == 0) { handSwingProgress = 1F; } else { - handSwingProgress = (animationTicks - 1F) / DulkirConfig.ConfigVars.getConfigOptions().getHandSwingDuration(); + handSwingProgress = (animationTicks - 1F) / + DulkirConfig.ConfigVars.getConfigOptions().getAnimationPreset().getSwingDuration(); animationTicks++; } } |