aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authoringlettronald <inglettronald@gmail.com>2023-06-30 03:57:04 -0500
committeringlettronald <inglettronald@gmail.com>2023-06-30 03:57:04 -0500
commit787b078f056c337fcc87c09963133693cc914fc8 (patch)
tree050ca0956966e977478a657e271374bd652f01bd /src/main
parentcd7b08b4799b5ee08f1dca6ff92a28e74d9db102 (diff)
downloadDulkirMod-Fabric-787b078f056c337fcc87c09963133693cc914fc8.tar.gz
DulkirMod-Fabric-787b078f056c337fcc87c09963133693cc914fc8.tar.bz2
DulkirMod-Fabric-787b078f056c337fcc87c09963133693cc914fc8.zip
Fixed small rendering error and code cleanup
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/dulkirfabric/mixin/render/ScreenMixin.java17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/main/java/com/dulkirfabric/mixin/render/ScreenMixin.java b/src/main/java/com/dulkirfabric/mixin/render/ScreenMixin.java
index 97acba1..60c13f6 100644
--- a/src/main/java/com/dulkirfabric/mixin/render/ScreenMixin.java
+++ b/src/main/java/com/dulkirfabric/mixin/render/ScreenMixin.java
@@ -15,23 +15,18 @@ package com.dulkirfabric.mixin.render;
import com.dulkirfabric.features.InventoryScale;
import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.Drawable;
-import net.minecraft.client.gui.Element;
-import net.minecraft.client.gui.Selectable;
import net.minecraft.client.gui.screen.Screen;
-
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.ModifyVariable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+import static java.lang.Math.ceil;
+
@Mixin(Screen.class)
public abstract class ScreenMixin {
- @Shadow
- protected abstract <T extends Element & Drawable & Selectable> T addDrawableChild(T drawableElement);
@Shadow public int width;
@@ -39,13 +34,13 @@ public abstract class ScreenMixin {
@Inject(method = "init(Lnet/minecraft/client/MinecraftClient;II)V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/Screen;height:I", shift = At.Shift.AFTER))
public void onInitAfterViewportSizeSet(MinecraftClient client, int width, int height, CallbackInfo ci) {
- this.width = (int) (width / InventoryScale.INSTANCE.getScale());
- this.height = (int)(height / InventoryScale.INSTANCE.getScale());
+ this.width = (int) ceil(width / InventoryScale.INSTANCE.getScale());
+ this.height = (int) ceil(height / InventoryScale.INSTANCE.getScale());
}
@Inject(method = "resize", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/Screen;height:I", shift = At.Shift.AFTER))
public void onResizeAfterViewportSizeSet(MinecraftClient client, int width, int height, CallbackInfo ci) {
- this.width = (int) (width / InventoryScale.INSTANCE.getScale());
- this.height = (int)(height / InventoryScale.INSTANCE.getScale());
+ this.width = (int) ceil(width / InventoryScale.INSTANCE.getScale());
+ this.height = (int) ceil(height / InventoryScale.INSTANCE.getScale());
}
} \ No newline at end of file