From 4ed98b32a3075a8c503a6819896e99e012cf3d17 Mon Sep 17 00:00:00 2001 From: Yang Xizhi <60341015+GlodBlock@users.noreply.github.com> Date: Tue, 18 Oct 2022 01:38:47 +0800 Subject: allow reload the fluid texture (#1477) fix fluid texture corruption after resource reload. e.g. switch language in game https://cdn.discordapp.com/attachments/522098956491030558/1031599367116836965/unknown.png --- src/main/java/gregtech/common/fluid/GT_Fluid.java | 26 ++++++++++------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'src/main/java/gregtech/common') diff --git a/src/main/java/gregtech/common/fluid/GT_Fluid.java b/src/main/java/gregtech/common/fluid/GT_Fluid.java index e768358503..dc40d35024 100644 --- a/src/main/java/gregtech/common/fluid/GT_Fluid.java +++ b/src/main/java/gregtech/common/fluid/GT_Fluid.java @@ -24,7 +24,6 @@ public class GT_Fluid extends Fluid implements IGT_Fluid, IGT_RegisteredFluid, R private final FluidState fluidState; private final Fluid iconsFrom; private Fluid registeredFluid; - private boolean hasRun = false; /** * Constructs this {@link IGT_Fluid} implementation from an {@link GT_FluidBuilder} instance @@ -186,21 +185,18 @@ public class GT_Fluid extends Fluid implements IGT_Fluid, IGT_RegisteredFluid, R */ @Override public void run() { - if (!hasRun) { - if (iconsFrom instanceof GT_Fluid) { - // Needs the GT_Fluid to have registered its icons - ((GT_Fluid) iconsFrom).run(); - stillIcon = iconsFrom.getStillIcon(); - flowingIcon = iconsFrom.getFlowingIcon(); - } else { - if (stillIconResourceLocation != null) { - stillIcon = GregTech_API.sBlockIcons.registerIcon(stillIconResourceLocation.toString()); - } - if (flowingIconResourceLocation != null) { - flowingIcon = GregTech_API.sBlockIcons.registerIcon(flowingIconResourceLocation.toString()); - } + if (iconsFrom instanceof GT_Fluid) { + // Needs the GT_Fluid to have registered its icons + ((GT_Fluid) iconsFrom).run(); + stillIcon = iconsFrom.getStillIcon(); + flowingIcon = iconsFrom.getFlowingIcon(); + } else { + if (stillIconResourceLocation != null) { + stillIcon = GregTech_API.sBlockIcons.registerIcon(stillIconResourceLocation.toString()); + } + if (flowingIconResourceLocation != null) { + flowingIcon = GregTech_API.sBlockIcons.registerIcon(flowingIconResourceLocation.toString()); } - hasRun = true; } } } -- cgit