fix: some tile entities have no bounds?
This commit is contained in:
parent
49c4b2fd47
commit
924601fc90
1 changed files with 6 additions and 2 deletions
|
@ -32,6 +32,7 @@ import net.minecraft.tileentity.ShulkerBoxTileEntity;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.tileentity.TrappedChestTileEntity;
|
import net.minecraft.tileentity.TrappedChestTileEntity;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
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.Vector3d;
|
||||||
import net.minecraft.util.math.vector.Vector3f;
|
import net.minecraft.util.math.vector.Vector3f;
|
||||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||||
|
@ -112,10 +113,13 @@ public class StorageESP extends QuickModule {
|
||||||
for (TileEntity ent : MC.level.tickableBlockEntities) {
|
for (TileEntity ent : MC.level.tickableBlockEntities) {
|
||||||
Vector3f color = this.tileHighlight(ent);
|
Vector3f color = this.tileHighlight(ent);
|
||||||
if (color != null) {
|
if (color != null) {
|
||||||
AxisAlignedBB bounds = ent.getBlockState().getCollisionShape(MC.level, ent.getBlockPos()).bounds().move(ent.getBlockPos());
|
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());
|
WorldRenderer.renderLineBox(stack, builder, bounds, color.x(), color.y(), color.z(), this.alpha.get().floatValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
builder.end();
|
builder.end();
|
||||||
WorldVertexBufferUploader.end(builder);
|
WorldVertexBufferUploader.end(builder);
|
||||||
|
|
Loading…
Reference in a new issue