fix spout rendering bug and crash

This commit is contained in:
MoePus 2024-10-04 23:21:39 +09:00
parent aa15182005
commit fbc99137c0
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);
}