From 924601fc906ce3072db21b0abee8fb9ccfeea31d Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 13 Mar 2023 03:19:39 +0100 Subject: fix: some tile entities have no bounds? --- src/main/java/ftbsc/bscv/modules/vision/StorageESP.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/main/java/ftbsc') diff --git a/src/main/java/ftbsc/bscv/modules/vision/StorageESP.java b/src/main/java/ftbsc/bscv/modules/vision/StorageESP.java index 975da95..47553e3 100644 --- a/src/main/java/ftbsc/bscv/modules/vision/StorageESP.java +++ b/src/main/java/ftbsc/bscv/modules/vision/StorageESP.java @@ -32,6 +32,7 @@ import net.minecraft.tileentity.ShulkerBoxTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TrappedChestTileEntity; import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3f; import net.minecraftforge.client.event.RenderWorldLastEvent; @@ -112,8 +113,11 @@ public class StorageESP extends QuickModule { for (TileEntity ent : MC.level.tickableBlockEntities) { Vector3f color = this.tileHighlight(ent); if (color != null) { - AxisAlignedBB bounds = ent.getBlockState().getCollisionShape(MC.level, ent.getBlockPos()).bounds().move(ent.getBlockPos()); - WorldRenderer.renderLineBox(stack, builder, bounds, color.x(), color.y(), color.z(), this.alpha.get().floatValue()); + VoxelShape shape = ent.getBlockState().getCollisionShape(MC.level, ent.getBlockPos()); + if (!shape.isEmpty()) { // this might be null in some rare occurrences, just skip rendering this block for this frame + AxisAlignedBB bounds = shape.bounds().move(ent.getBlockPos()); + WorldRenderer.renderLineBox(stack, builder, bounds, color.x(), color.y(), color.z(), this.alpha.get().floatValue()); + } } } -- cgit v1.2.3-56-ga3b1