diff --git a/CHANGELOG.md b/CHANGELOG.md index eb4b85e2..a71387ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1 @@ -- Fixed Controlify 2.0 compatibility. -- Updated Forge version to NeoForge 1.20.4. - - LexForge will not be supported from now on. +- Updated to 1.20.6. \ No newline at end of file diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/InGameHudMixin.java b/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/InGameHudMixin.java index 91fa7fde..a99b5b89 100644 --- a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/InGameHudMixin.java +++ b/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/InGameHudMixin.java @@ -5,33 +5,27 @@ import nl.enjarai.doabarrelroll.EventCallbacksClient; import nl.enjarai.doabarrelroll.util.StarFoxUtil; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(InGameHud.class) public abstract class InGameHudMixin { - @Shadow private int scaledWidth; - @Shadow private int scaledHeight; - @Inject( - method = "render", + method = "renderCrosshair", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/gui/hud/InGameHud;renderCrosshair(Lnet/minecraft/client/gui/DrawContext;)V" + value = "HEAD" ) ) private void doABarrelRoll$captureTickDelta(DrawContext context, float tickDelta, CallbackInfo ci) { context.getMatrices().push(); - EventCallbacksClient.onRenderCrosshair(context, tickDelta, scaledWidth, scaledHeight); + EventCallbacksClient.onRenderCrosshair(context, tickDelta, context.getScaledWindowWidth(), context.getScaledWindowHeight()); } @Inject( - method = "render", + method = "renderCrosshair", at = @At( - value = "CONSTANT", - args = "stringValue=bossHealth" + value = "RETURN" ) ) private void doABarrelRoll$renderCrosshairReturn(DrawContext context, float tickDelta, CallbackInfo ci) { @@ -42,11 +36,11 @@ public abstract class InGameHudMixin { method = "render", at = @At( value = "INVOKE", - target = "Lnet/minecraft/util/math/MathHelper;lerp(FFF)F", + target = "Lnet/minecraft/client/gui/LayeredDrawer;render(Lnet/minecraft/client/gui/DrawContext;F)V", ordinal = 0 ) ) private void doABarrelRoll$renderPeppy(DrawContext context, float tickDelta, CallbackInfo ci) { - StarFoxUtil.renderPeppy(context, tickDelta, scaledWidth, scaledHeight); + StarFoxUtil.renderPeppy(context, tickDelta, context.getScaledWindowWidth(), context.getScaledWindowHeight()); } } diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/DebugHudMixin.java b/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/DebugHudMixin.java index aa3b490f..8329360f 100644 --- a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/DebugHudMixin.java +++ b/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/DebugHudMixin.java @@ -19,7 +19,7 @@ public abstract class DebugHudMixin { at = @At( value = "INVOKE", target = "Ljava/lang/String;format(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;", - ordinal = 6 + ordinal = 7 ), index = 1, require = 0 @@ -39,7 +39,7 @@ public abstract class DebugHudMixin { at = @At( value = "INVOKE", target = "Ljava/lang/String;format(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;", - ordinal = 6 + ordinal = 7 ), index = 2, require = 0 diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/GameRendererMixin.java b/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/GameRendererMixin.java index 53b3c54a..bda0bd33 100644 --- a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/GameRendererMixin.java +++ b/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/GameRendererMixin.java @@ -2,29 +2,30 @@ import net.minecraft.client.render.Camera; import net.minecraft.client.render.GameRenderer; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.RotationAxis; import nl.enjarai.doabarrelroll.api.RollCamera; +import nl.enjarai.doabarrelroll.math.MagicNumbers; +import org.joml.Matrix4f; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.Redirect; @Mixin(GameRenderer.class) public abstract class GameRendererMixin { @Shadow @Final private Camera camera; - @Inject( + @Redirect( method = "renderWorld", at = @At( value = "INVOKE", - target = "Lnet/minecraft/util/math/RotationAxis;rotationDegrees(F)Lorg/joml/Quaternionf;", - ordinal = 2 + target = "Lorg/joml/Matrix4f;rotationXYZ(FFF)Lorg/joml/Matrix4f;", + ordinal = 0 ) ) - public void doABarrelRoll$renderWorld(float tickDelta, long limitTime, MatrixStack matrix, CallbackInfo ci) { - matrix.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(((RollCamera) camera).doABarrelRoll$getRoll())); + public Matrix4f doABarrelRoll$renderWorld(Matrix4f instance, float angleX, float angleY, float angleZ) { + return instance.rotateZ((float) (((RollCamera) camera).doABarrelRoll$getRoll() * MagicNumbers.TORAD)) + .rotateX(angleX) + .rotateY(angleY); } } diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/MouseMixin.java b/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/MouseMixin.java index 6f365e9e..b104be8d 100644 --- a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/MouseMixin.java +++ b/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/MouseMixin.java @@ -1,8 +1,7 @@ package nl.enjarai.doabarrelroll.mixin.client.roll; import com.llamalad7.mixinextras.injector.WrapWithCondition; -import com.llamalad7.mixinextras.sugar.Share; -import com.llamalad7.mixinextras.sugar.ref.LocalDoubleRef; +import com.llamalad7.mixinextras.sugar.Local; import net.minecraft.client.MinecraftClient; import net.minecraft.client.Mouse; import net.minecraft.client.network.ClientPlayerEntity; @@ -16,33 +15,16 @@ import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(Mouse.class) public abstract class MouseMixin implements RollMouse { @Shadow @Final private MinecraftClient client; - @Shadow private double lastMouseUpdateTime; + @Shadow private double lastTickTime; @Unique private final Vector2d mouseTurnVec = new Vector2d(); - @ModifyVariable( - method = "updateMouse", - index = 3, - at = @At( - value = "STORE", - ordinal = 0 - ) - ) - private double doABarrelRoll$captureDelta(double original, @Share("mouseDelta") LocalDoubleRef mouseDeltaRef) { - if (lastMouseUpdateTime != Double.MIN_VALUE) { - mouseDeltaRef.set(original); - } - - return original; - } - @Inject( method = "updateMouse", at = @At( @@ -50,9 +32,9 @@ public abstract class MouseMixin implements RollMouse { ordinal = 0 ) ) - private void doABarrelRoll$maintainMouseMomentum(CallbackInfo ci, @Share("mouseDelta") LocalDoubleRef mouseDeltaRef) { + private void doABarrelRoll$maintainMouseMomentum(double timeDelta, CallbackInfo ci) { if (client.player != null && !client.isPaused()) { - doABarrelRoll$updateMouse(client.player, 0, 0, mouseDeltaRef.get()); + doABarrelRoll$updateMouse(client.player, 0, 0, timeDelta); } } @@ -63,8 +45,8 @@ public abstract class MouseMixin implements RollMouse { target = "Lnet/minecraft/client/network/ClientPlayerEntity;changeLookDirection(DD)V" ) ) - private boolean doABarrelRoll$changeLookDirection(ClientPlayerEntity player, double cursorDeltaX, double cursorDeltaY, @Share("mouseDelta") LocalDoubleRef mouseDeltaRef) { - return !doABarrelRoll$updateMouse(player, cursorDeltaX, cursorDeltaY, mouseDeltaRef.get()); + private boolean doABarrelRoll$changeLookDirection(ClientPlayerEntity player, double cursorDeltaX, double cursorDeltaY, @Local(argsOnly = true) double timeDelta) { + return !doABarrelRoll$updateMouse(player, cursorDeltaX, cursorDeltaY, timeDelta); } @Override diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/PlayerEntityRendererMixin.java b/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/PlayerEntityRendererMixin.java index 10f881c2..1d15b1e1 100644 --- a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/PlayerEntityRendererMixin.java +++ b/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/PlayerEntityRendererMixin.java @@ -3,20 +3,17 @@ import com.llamalad7.mixinextras.sugar.Local; import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.render.entity.PlayerEntityRenderer; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.math.RotationAxis; import nl.enjarai.doabarrelroll.api.RollEntity; import org.joml.Quaternionf; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyArg; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(PlayerEntityRenderer.class) public abstract class PlayerEntityRendererMixin { @ModifyArg( - method = "setupTransforms(Lnet/minecraft/client/network/AbstractClientPlayerEntity;Lnet/minecraft/client/util/math/MatrixStack;FFF)V", + method = "setupTransforms(Lnet/minecraft/client/network/AbstractClientPlayerEntity;Lnet/minecraft/client/util/math/MatrixStack;FFFF)V", at = @At( value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;multiply(Lorg/joml/Quaternionf;)V", diff --git a/fabric/build.gradle b/fabric/build.gradle index 8db6abaa..14d88477 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -7,7 +7,7 @@ dependencies { mappings "net.fabricmc:yarn:${yarn_version}:v2" modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}" - implementation project(":common") + implementation project(path: ":common", configuration: "namedElements") modImplementation("nl.enjarai:cicada-lib:${project.cicada_version}") { exclude group: "net.fabricmc.fabric-api" diff --git a/gradle.properties b/gradle.properties index c11f1028..ca4bd7bb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false # Project -mod_version=3.5.4 +mod_version=3.5.6 group=nl.enjarai # Common