From 9f1ab9fb5bd235cc1f4b85ae6f5a52731158e56d Mon Sep 17 00:00:00 2001 From: Buuz135 Date: Sun, 30 May 2021 00:42:49 +0200 Subject: [PATCH] Fixed Tank screen addons not rendering the fluid when max int, closes #87 --- .../titanium/client/screen/addon/TankScreenAddon.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/hrznstudio/titanium/client/screen/addon/TankScreenAddon.java b/src/main/java/com/hrznstudio/titanium/client/screen/addon/TankScreenAddon.java index 35f9a2d2..e34bc816 100644 --- a/src/main/java/com/hrznstudio/titanium/client/screen/addon/TankScreenAddon.java +++ b/src/main/java/com/hrznstudio/titanium/client/screen/addon/TankScreenAddon.java @@ -63,10 +63,10 @@ public void drawBackgroundLayer(MatrixStack stack, Screen screen, IAssetProvider Rectangle area = asset.getArea(); if (!tank.getFluid().isEmpty()) { FluidStack fluidStack = tank.getFluid(); - int stored = tank.getFluidAmount(); - int capacity = tank.getCapacity(); + double stored = tank.getFluidAmount(); + double capacity = tank.getCapacity(); int topBottomPadding = asset.getFluidRenderPadding(Direction.UP) + asset.getFluidRenderPadding(Direction.DOWN); - int offset = (stored * (area.height - topBottomPadding) / capacity); + int offset = (int) ((stored / capacity) * (area.height - topBottomPadding)); ResourceLocation flowing = fluidStack.getFluid().getAttributes().getStillTexture(fluidStack); if (flowing != null) { Texture texture = screen.getMinecraft().getTextureManager().getTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); //getAtlasSprite