From fbc99137c039d20dfe91e2ddc25d73d2561c91ee Mon Sep 17 00:00:00 2001 From: MoePus <547007249@qq.com> Date: Fri, 4 Oct 2024 23:21:39 +0900 Subject: [PATCH] fix spout rendering bug and crash --- .../create/content/fluids/spout/SpoutBlockEntity.java | 2 ++ .../simibubi/create/content/fluids/spout/SpoutRenderer.java | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/fluids/spout/SpoutBlockEntity.java b/src/main/java/com/simibubi/create/content/fluids/spout/SpoutBlockEntity.java index 1712fcccb..4b7b4b312 100644 --- a/src/main/java/com/simibubi/create/content/fluids/spout/SpoutBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/fluids/spout/SpoutBlockEntity.java @@ -232,6 +232,8 @@ public class SpoutBlockEntity extends SmartBlockEntity implements IHaveGoggleInf protected void spawnProcessingParticles(FluidStack fluid) { if (isVirtual()) return; + if(fluid.isEmpty()) + return; Vec3 vec = VecHelper.getCenterOf(worldPosition); vec = vec.subtract(0, 8 / 16f, 0); ParticleOptions particle = FluidFX.getFluidParticle(fluid); diff --git a/src/main/java/com/simibubi/create/content/fluids/spout/SpoutRenderer.java b/src/main/java/com/simibubi/create/content/fluids/spout/SpoutRenderer.java index c4502024c..5d5315544 100644 --- a/src/main/java/com/simibubi/create/content/fluids/spout/SpoutRenderer.java +++ b/src/main/java/com/simibubi/create/content/fluids/spout/SpoutRenderer.java @@ -65,9 +65,9 @@ public class SpoutRenderer extends SafeBlockEntityRenderer { processingProgress = Mth.clamp(processingProgress, 0, 1); float radius = 0; - if (processingTicks != -1) { + if (!fluidStack.isEmpty() && processingTicks != -1) { radius = (float) (Math.pow(((2 * processingProgress) - 1), 2) - 1); - AABB bb = new AABB(0.5, .5, 0.5, 0.5, -1.2, 0.5).inflate(radius / 32f); + AABB bb = new AABB(0.5, 0.0, 0.5, 0.5, -1.2, 0.5).inflate(radius / 32f); FluidRenderer.renderFluidBox(fluidStack, (float) bb.minX, (float) bb.minY, (float) bb.minZ, (float) bb.maxX, (float) bb.maxY, (float) bb.maxZ, buffer, ms, light, true); }