aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/dulkirfabric/mixin/render/HeldItemRendererMixin.java26
-rw-r--r--src/main/java/com/dulkirfabric/mixin/render/LivingEntityMixin.java7
-rw-r--r--src/main/kotlin/com/dulkirfabric/DulkirModFabric.kt1
3 files changed, 22 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++;
}
}
diff --git a/src/main/kotlin/com/dulkirfabric/DulkirModFabric.kt b/src/main/kotlin/com/dulkirfabric/DulkirModFabric.kt
index 0610bd9..f10d048 100644
--- a/src/main/kotlin/com/dulkirfabric/DulkirModFabric.kt
+++ b/src/main/kotlin/com/dulkirfabric/DulkirModFabric.kt
@@ -47,6 +47,7 @@ object DulkirModFabric : ModInitializer {
Registrations.registerEvents()
DulkirConfig.loadConfig()
+ System.setProperty("java.awt.headless", "false");
}
} \ No newline at end of file