Skip to content

Commit

Permalink
I'm sure it'll be fine (no backport this ok thanks future me)
Browse files Browse the repository at this point in the history
  • Loading branch information
enjarai committed May 17, 2024
1 parent 537e91c commit 59d7651
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
- Fixed rotation not continuing to drift with a ui open.
- Fixed some networking elements using the wrong protocol version, creating log warnings.
- Fixed Iris compatibility. (in theory)
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package nl.enjarai.doabarrelroll.mixin.client.roll;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.GameRenderer;
import nl.enjarai.doabarrelroll.api.RollCamera;
Expand All @@ -9,23 +11,26 @@
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.Redirect;

@Mixin(GameRenderer.class)
@Mixin(value = GameRenderer.class, priority = 900)
public abstract class GameRendererMixin {
@Shadow @Final private Camera camera;

@Redirect(
@WrapOperation(
method = "renderWorld",
at = @At(
value = "INVOKE",
target = "Lorg/joml/Matrix4f;rotationXYZ(FFF)Lorg/joml/Matrix4f;",
ordinal = 0
)
)
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);
public Matrix4f doABarrelRoll$renderWorld(Matrix4f instance, float angleX, float angleY, float angleZ, Operation<Matrix4f> original) {
var roll = ((RollCamera) camera).doABarrelRoll$getRoll() * MagicNumbers.TORAD;
if (roll != 0) {
return instance.rotateZ((float) roll)
.rotateX(angleX)
.rotateY(angleY);
}
return original.call(instance, angleX, angleY, angleZ);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@

import com.bawnorton.mixinsquared.api.MixinCanceller;
import com.bawnorton.mixinsquared.tools.MixinAnnotationReader;
import net.fabricmc.loader.api.FabricLoader;

import java.util.List;

public class DABRMixinCanceller implements MixinCanceller {
// public static final String GAME_RENDERER_CLASSNAME = FabricLoader.getInstance().getMappingResolver()
// .mapClassName("intermediary", "net.minecraft.class_757").replace('.', '/');

@Override
public boolean shouldCancel(List<String> targetClassNames, String mixinClassName) {
if (mixinClassName.equals("com.anthonyhilyard.equipmentcompare.mixin.KeyMappingMixin") && MixinAnnotationReader.getPriority(mixinClassName) == 1000) {
DoABarrelRoll.LOGGER.warn("Equipment Compare detected, disabling their overly invasive keybinding mixin. Report any relevant issues to them.");
DoABarrelRoll.LOGGER.warn("If the author of Equipment Compare is reading this: see #31 on your github. Once the issue is resolved, you can set the priority of this mixin to anything other than 1000 to stop it being disabled.");
return true;
}
// if (mixinClassName.equals("me.fzzyhmstrs.keybind_fix.mixins.KeybindingMixin") && MixinAnnotationReader.getPriority(mixinClassName) == 1000) {
// DoABarrelRoll.LOGGER.warn("Keybind Fix detected, disabling their overly invasive keybinding mixin (Ironic, I know). Report any relevant issues to them.");
// DoABarrelRoll.LOGGER.warn("If the author of Keybind Fix is reading this: please don't use unconditionally cancelled injects... try looking into MixinExtras! Once the issue is resolved, you can set the priority of this mixin to anything other than 1000 to stop it being disabled.");
// return true;
// if (targetClassNames.contains(GAME_RENDERER_CLASSNAME) && !mixinClassName.contains("doabarrelroll")) {
// DoABarrelRoll.LOGGER.warn("Found mixin targeting GameRenderer. If this is done to modify matrices, it might create incompatibilities. Mixin classname: {}", mixinClassName);
// }
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

# Project
mod_version=3.5.7
mod_version=3.5.8
group=nl.enjarai

# Common
Expand Down

0 comments on commit 59d7651

Please sign in to comment.