summaryrefslogtreecommitdiff
path: root/src/main/java/ftbsc
diff options
context:
space:
mode:
author alemi <me@alemi.dev>2023-03-13 03:19:39 +0100
committer alemi <me@alemi.dev>2023-03-13 03:19:39 +0100
commit924601fc906ce3072db21b0abee8fb9ccfeea31d (patch)
tree93dfd1b2d6eb7a5fd361d7e28350b1f93ea03410 /src/main/java/ftbsc
parent49c4b2fd47fc3e7bf473172549bdc1251adc65aa (diff)
fix: some tile entities have no bounds?
Diffstat (limited to 'src/main/java/ftbsc')
-rw-r--r--src/main/java/ftbsc/bscv/modules/vision/StorageESP.java8
1 files changed, 6 insertions, 2 deletions
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());
+ }
}
}