Pose stack says no

- TileEntities not appreciative of wrapped worlds are now much less likely to cause a hard crash
This commit is contained in:
simibubi 2021-04-11 02:56:11 +02:00
parent 976be3470f
commit d249318b80

View file

@ -54,19 +54,17 @@ public class TileEntityRenderHelper {
continue; continue;
} }
try { BlockPos pos = tileEntity.getPos();
BlockPos pos = tileEntity.getPos(); ms.push();
ms.push(); MatrixStacker.of(ms)
MatrixStacker.of(ms) .translate(pos);
.translate(pos);
try {
Vector4f vec = new Vector4f(pos.getX() + .5f, pos.getY() + .5f, pos.getZ() + .5f, 1); Vector4f vec = new Vector4f(pos.getX() + .5f, pos.getY() + .5f, pos.getZ() + .5f, 1);
vec.transform(matrix); vec.transform(matrix);
BlockPos lightPos = new BlockPos(vec.getX(), vec.getY(), vec.getZ()); BlockPos lightPos = new BlockPos(vec.getX(), vec.getY(), vec.getZ());
int worldLight = ContraptionRenderDispatcher.getLightOnContraption(world, renderWorld, pos, lightPos); int worldLight = ContraptionRenderDispatcher.getLightOnContraption(world, renderWorld, pos, lightPos);
renderer.render(tileEntity, pt, ms, buffer, worldLight, OverlayTexture.DEFAULT_UV); renderer.render(tileEntity, pt, ms, buffer, worldLight, OverlayTexture.DEFAULT_UV);
ms.pop();
} catch (Exception e) { } catch (Exception e) {
iterator.remove(); iterator.remove();
@ -74,14 +72,13 @@ public class TileEntityRenderHelper {
String message = "TileEntity " + tileEntity.getType() String message = "TileEntity " + tileEntity.getType()
.getRegistryName() .getRegistryName()
.toString() + " didn't want to render while moved.\n"; .toString() + " didn't want to render while moved.\n";
if (AllConfigs.CLIENT.explainRenderErrors.get()) { if (AllConfigs.CLIENT.explainRenderErrors.get())
Create.logger.error(message, e); Create.logger.error(message, e);
continue; else
} Create.logger.error(message);
Create.logger.error(message);
continue;
} }
ms.pop();
} }
} }