Skip to content

Commit

Permalink
fix inventory scale mouse issues and give StatusEffectsDisplayMixin a…
Browse files Browse the repository at this point in the history
… more appropriate name
  • Loading branch information
inglettronald committed Dec 20, 2024
1 parent 8b223de commit cefd1c9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 24 deletions.
44 changes: 22 additions & 22 deletions src/main/java/com/dulkirfabric/mixin/io/MouseMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,6 @@ public int onMouseButtonHeight(int originalScaledHeight) {
return (int) (originalScaledHeight / InventoryScale.INSTANCE.getScale());
}

// @ModifyExpressionValue(
// method = "onCursorPos",
// at = @At(
// value = "INVOKE",
// target = "Lnet/minecraft/client/util/Window;getScaledWidth()I"
// )
// )
// public int onCursorPosWidth(int originalScaledWidth) {
// return (int) (originalScaledWidth / InventoryScale.INSTANCE.getScale());
// }
//
// @ModifyExpressionValue(
// method = "onCursorPos",
// at = @At(
// value = "INVOKE",
// target = "Lnet/minecraft/client/util/Window;getScaledHeight()I"
// )
// )
// public int onCursorPosHeight(int originalScaledHeight) {
// return (int) (originalScaledHeight / InventoryScale.INSTANCE.getScale());
// }

@ModifyExpressionValue(
method = "onMouseScroll",
at = @At(
Expand All @@ -75,5 +53,27 @@ public int onMouseScrollHeight(int originalScaledHeight) {
return (int) (originalScaledHeight / InventoryScale.INSTANCE.getScale());
}

@ModifyExpressionValue(
method = "tick",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/util/Window;getScaledHeight()I"
)
)
public int onTickHeight(int originalScaledHeight) {
return (int) (originalScaledHeight / InventoryScale.INSTANCE.getScale());
}

@ModifyExpressionValue(
method = "tick",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/util/Window;getScaledWidth()I"
)
)
public int onTickWidth(int originalScaledWidth) {
return (int) (originalScaledWidth / InventoryScale.INSTANCE.getScale());
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(StatusEffectsDisplay.class)
public class AbstractInventoryScreenMixin {
public class StatusEffectsDisplayMixin {

@Inject(
method = "drawStatusEffects(Lnet/minecraft/client/gui/DrawContext;II)V",
Expand All @@ -21,4 +21,5 @@ public void onDrawStatusEffects(DrawContext context, int mouseX, int mouseY, Cal
ci.cancel();
}
}

}
2 changes: 1 addition & 1 deletion src/main/resources/dulkirmod-fabric.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"io.KeyboardMixin",
"io.MouseMixin",
"io.SoundSystemMixin",
"render.AbstractInventoryScreenMixin",
"render.StatusEffectsDisplayMixin",
"render.DrawContextMixin",
"render.GameMenuScreenMixin",
"render.GameRendererMixin",
Expand Down

0 comments on commit cefd1c9

Please sign in to comment.