Fix rare spout crash and offset rendering (#7025)

This commit is contained in:
MoePus 2025-01-27 08:44:40 +09:00 committed by GitHub
parent 28d30f3c62
commit 4ba5e984a9
Failed to generate hash of commit
2 changed files with 4 additions and 2 deletions

View file

@ -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);

View file

@ -65,9 +65,9 @@ public class SpoutRenderer extends SafeBlockEntityRenderer<SpoutBlockEntity> {
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);
}