Skip to content

Commit

Permalink
This is a forge moment ngl
Browse files Browse the repository at this point in the history
  • Loading branch information
enjarai committed Mar 28, 2024
1 parent 5cda607 commit 7168372
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
4 changes: 1 addition & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
- Unembedded a dependency on my shared library.
- This reduces disk space required when using more than one of my mods.
- It also makes it easier for me to push fixes to that library without creating updates for every single mod that uses it.
- Fixed an issue with hud rendering on Forge introduced in a recent update. (#127)
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package nl.enjarai.doabarrelroll.mixin.forge;

import com.llamalad7.mixinextras.sugar.Share;
import com.llamalad7.mixinextras.sugar.ref.LocalFloatRef;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.hud.InGameHud;
import nl.enjarai.doabarrelroll.EventCallbacksClient;
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
protected int scaledWidth;
@Shadow
protected int scaledHeight;

@Inject(
method = "renderCrosshair",
at = @At(value = "HEAD")
)
private void doABarrelRoll$renderCrosshairHead(DrawContext context, CallbackInfo ci) {
context.getMatrices().push();
// There's really no way for me to get it, so no tickdelta for you Forge!
EventCallbacksClient.onRenderCrosshair(context, 0, scaledWidth, scaledHeight);
}

@Inject(
method = "renderCrosshair",
at = @At(value = "RETURN")
)
private void doABarrelRoll$renderCrosshairReturn(DrawContext context, CallbackInfo ci) {
context.getMatrices().pop();
}
}
3 changes: 2 additions & 1 deletion forge/src/main/resources/do_a_barrel_roll.forge.mixins.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"required": true,
"minVersion": "0.8",
"package": "nl.enjarai.doabarrelroll.mixin",
"package": "nl.enjarai.doabarrelroll.mixin.forge",
"refmap": "${mod_id}.refmap.json",
"compatibilityLevel": "JAVA_17",
"mixins": [
],
"client": [
"InGameHudMixin"
],
"server": [
],
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.3
mod_version=3.5.4
group=nl.enjarai

# Common
Expand Down

0 comments on commit 7168372

Please sign in to comment.