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 | |
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')
3 files changed, 39 insertions, 15 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; + } } diff --git a/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt b/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt index 0b04c0f..a3a73aa 100644 --- a/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt +++ b/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt @@ -152,18 +152,21 @@ class DulkirConfig { //TODO: Come up with some custome float slider instead of int slider jank animations.addEntry( - entryBuilder.startIntSlider(Text.literal("posX"), configOptions.heldItemPosX, -300, 300) + entryBuilder.startIntSlider(Text.literal("posX"), configOptions.heldItemPosX, -150, 150) .setSaveConsumer { newValue -> configOptions.heldItemPosX = newValue } + .setDefaultValue(0) .build() ) animations.addEntry( - entryBuilder.startIntSlider(Text.literal("posY"), configOptions.heldItemPosY, -300, 300) + entryBuilder.startIntSlider(Text.literal("posY"), configOptions.heldItemPosY, -150, 150) .setSaveConsumer { newValue -> configOptions.heldItemPosY = newValue } + .setDefaultValue(0) .build() ) animations.addEntry( - entryBuilder.startIntSlider(Text.literal("posZ"), configOptions.heldItemPosZ, -300, 300) + entryBuilder.startIntSlider(Text.literal("posZ"), configOptions.heldItemPosZ, -150, 50) .setSaveConsumer { newValue -> configOptions.heldItemPosZ = newValue } + .setDefaultValue(0) .build() ) animations.addEntry( @@ -182,7 +185,7 @@ class DulkirConfig { .build() ) animations.addEntry( - entryBuilder.startFloatField(Text.literal("scale"), configOptions.heldItemScale) + entryBuilder.startFloatField(Text.literal("Held Item Scale"), configOptions.heldItemScale) .setTooltip(Text.literal("Recommended range of .1 - 2")) .setSaveConsumer { newValue -> configOptions.heldItemScale = newValue @@ -190,10 +193,13 @@ class DulkirConfig { .build() ) animations.addEntry( - entryBuilder.startIntSlider(Text.literal("rotationZ"), configOptions.handSwingDuration, 2, 15) + entryBuilder.startIntSlider(Text.literal("Swing Speed"), configOptions.handSwingDuration, 2, 20) .setSaveConsumer { newValue -> configOptions.handSwingDuration = newValue } .build() ) + animations.addEntry( + entryBuilder.mkToggle(Text.literal("Cancel Re-equip Animation"), configOptions::cancelReEquip) + ) builder.transparentBackground() @@ -224,10 +230,11 @@ class DulkirConfig { var heldItemRotX: Int = 0, var heldItemRotY: Int = 0, var heldItemRotZ: Int = 0, - var heldItemScale: Float = 0f, + var heldItemScale: Float = 1f, + var handSwingDuration: Int = 6, + var cancelReEquip: Boolean = false, var duraCooldown: Boolean = false, - var alarmTimeout: Int = 300, - var handSwingDuration: Int = 6 + var alarmTimeout: Int = 300 ) @Serializable |