diff --git a/src/main/java/aeronicamc/mods/mxtune/render/OverlayInstance.java b/src/main/java/aeronicamc/mods/mxtune/render/OverlayInstance.java index fdd95e13..a2e528e6 100644 --- a/src/main/java/aeronicamc/mods/mxtune/render/OverlayInstance.java +++ b/src/main/java/aeronicamc/mods/mxtune/render/OverlayInstance.java @@ -30,14 +30,14 @@ private float getVisibility(long milliseconds) { /** * Render an overlay instance. * - * @param x screen right. - * @param y render top. - * @param instIndex render top. - * @param pPoseStack matrix. + * @param scaledWidth Gui Scaled Width. + * @param scaledHeight Gui Scaled Height. + * @param instIndex Instance index. + * @param pPoseStack matrix. * @return true when rendering is done for this instance. Slide in, pause, slide out. */ @SuppressWarnings("deprecation") - public boolean render(int x, int y, int instIndex, MatrixStack pPoseStack) { + public boolean render(int scaledWidth, int scaledHeight, int instIndex, MatrixStack pPoseStack) { long ms = Util.getMillis(); if (this.animationTime == -1L) { this.animationTime = ms; @@ -49,19 +49,19 @@ public boolean render(int x, int y, int instIndex, MatrixStack pPoseStack) { } IOverlayItem.Position position = overlayItemPosition.getPosition(this.overlayItem); - float ratio = Math.max(Math.min(Math.abs(overlayItemPosition.getPercent(this.overlayItem) / 100F), 1F), 0F); + float decimalPercent = Math.max(Math.min(Math.abs(overlayItemPosition.getPercent(this.overlayItem) / 100F), 1F), 0F); float xPos; - float yPos = 0F + (y * ratio) - (y * ratio > this.overlayItem.totalHeight() ? this.overlayItem.totalHeight() : 0); + float yPos = ((scaledHeight - this.overlayItem.totalHeight()) * decimalPercent); switch (position) { case LEFT: xPos = this.overlayItem.totalWidth() * (1 - this.getVisibility(ms)) + this.overlayItem.totalWidth() * (this.getVisibility(ms)) - this.overlayItem.totalWidth(); break; case CENTER: - xPos = ((x * this.getVisibility(ms) * 0.5F)) + ((x * (1F - this.getVisibility(ms)) * 0.5F)) - this.overlayItem.totalWidth() * 0.5F * (this.getVisibility(ms)); + xPos = ((scaledWidth * this.getVisibility(ms) * 0.5F)) + ((scaledWidth * (1F - this.getVisibility(ms)) * 0.5F)) - this.overlayItem.totalWidth() * 0.5F * (this.getVisibility(ms)); break; case RIGHT: - xPos = (float) x - (float) this.overlayItem.totalWidth() * this.getVisibility(ms); + xPos = (float) scaledWidth - (float) this.overlayItem.totalWidth() * this.getVisibility(ms); break; default: throw new IllegalStateException("Unexpected value: " + position);