From dbcf8bd0751ea4c69dc0e2d6610d99f5ee80e2b3 Mon Sep 17 00:00:00 2001 From: malte0811 Date: Thu, 10 Sep 2020 20:02:06 +0200 Subject: [PATCH] Fix exception when getting rendering box for tile entities with no collision boxes. (#7301) --- .../minecraftforge/common/extensions/IForgeTileEntity.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeTileEntity.java b/src/main/java/net/minecraftforge/common/extensions/IForgeTileEntity.java index 02053c029..4e4fc8dcc 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeTileEntity.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeTileEntity.java @@ -28,6 +28,7 @@ import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -139,7 +140,11 @@ public interface IForgeTileEntity extends ICapabilitySerializable AxisAlignedBB cbb = null; try { - cbb = state.getCollisionShape(getTileEntity().getWorld(), pos).getBoundingBox().offset(pos); + VoxelShape collisionShape = state.getCollisionShape(getTileEntity().getWorld(), pos); + if (!collisionShape.isEmpty()) + { + cbb = collisionShape.getBoundingBox().offset(pos); + } } catch (Exception e) {