aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/firmament
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2023-11-12 05:30:36 +0100
committerLinnea Gräf <nea@nea.moe>2023-11-12 05:30:36 +0100
commite580023cce085c84361a00a5b6115fceac325259 (patch)
treef6eda203e1edc607ee97e24b414d208c3116be29 /src/main/java/moe/nea/firmament
parentf5515b455d607ddda5b215a8c4c1df9ff03e4117 (diff)
downloadFirmament-e580023cce085c84361a00a5b6115fceac325259.tar.gz
Firmament-e580023cce085c84361a00a5b6115fceac325259.tar.bz2
Firmament-e580023cce085c84361a00a5b6115fceac325259.zip
Actually render inventory buttons
Diffstat (limited to 'src/main/java/moe/nea/firmament')
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MixinHandledScreen.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/MixinHandledScreen.java b/src/main/java/moe/nea/firmament/mixins/MixinHandledScreen.java
index 3972ffc..35856cb 100644
--- a/src/main/java/moe/nea/firmament/mixins/MixinHandledScreen.java
+++ b/src/main/java/moe/nea/firmament/mixins/MixinHandledScreen.java
@@ -35,6 +35,10 @@ public abstract class MixinHandledScreen<T extends ScreenHandler> {
@Shadow
public abstract T getScreenHandler();
+ @Shadow
+ protected int y;
+ @Shadow
+ protected int x;
@Unique
PlayerInventory playerInventory;
@@ -52,14 +56,17 @@ public abstract class MixinHandledScreen<T extends ScreenHandler> {
@Inject(method = "mouseClicked", at = @At("HEAD"), cancellable = true)
public void onMouseClicked(double mouseX, double mouseY, int button, CallbackInfoReturnable<Boolean> cir) {
- if (ScreenClickEvent.Companion.publish(new ScreenClickEvent((HandledScreen<?>) (Object) this, mouseX, mouseY, button)).getCancelled()) {
+ if (HandledScreenClickEvent.Companion.publish(new HandledScreenClickEvent((HandledScreen<?>) (Object) this, mouseX, mouseY, button)).getCancelled()) {
cir.setReturnValue(true);
}
}
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;drawForeground(Lnet/minecraft/client/gui/DrawContext;II)V", shift = At.Shift.AFTER))
public void onAfterRenderForeground(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
- HandledScreenForegroundEvent.Companion.publish(new HandledScreenForegroundEvent((HandledScreen<?>) (Object) this, mouseX, mouseY, delta));
+ context.getMatrices().push();
+ context.getMatrices().translate(-x, -y, 0);
+ HandledScreenForegroundEvent.Companion.publish(new HandledScreenForegroundEvent((HandledScreen<?>) (Object) this, context, mouseX, mouseY, delta));
+ context.getMatrices().pop();
}
@Inject(method = "onMouseClick(Lnet/minecraft/screen/slot/Slot;IILnet/minecraft/screen/slot/SlotActionType;)V", at = @At("HEAD"), cancellable = true)