diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/dulkirfabric/mixin/render/ScreenMixin.java | 17 |
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 |