Fix NPE in clipsAnything at world height

If the block is out of bounds, then the block state may
be null.
This commit is contained in:
Spottedleaf
2023-09-13 13:36:14 -07:00
parent fcc3b02a54
commit 5f11d81b11
2 changed files with 2 additions and 2 deletions

View File

@@ -343,7 +343,7 @@ public abstract class EntityMixin implements CollisionEntity {
final int newChunkX = fx >> 4;
final int newChunkZ = fz >> 4;
final LevelChunk chunk = lastChunkKey == (lastChunkKey = CoordinateUtils.getChunkKey(newChunkX, newChunkZ)) ?
lastChunk : (lastChunk = (LevelChunk)chunkProvider.getChunk(fx >> 4, fz >> 4, ChunkStatus.FULL, true));
lastChunk : (lastChunk = (LevelChunk)chunkProvider.getChunk(newChunkX, newChunkZ, ChunkStatus.FULL, true));
tempPos.setX(fx);
for (int fy = minY; fy <= maxY; ++fy) {
tempPos.setY(fy);

View File

@@ -245,7 +245,7 @@ public abstract class ExplosionMixin {
}
final BlockState blockState = cachedBlock.blockState;
if (!((CollisionBlockState)blockState).emptyCollisionShape()) {
if (blockState != null && !((CollisionBlockState)blockState).emptyCollisionShape()) {
VoxelShape collision = cachedBlock.cachedCollisionShape;
if (collision == null) {
collision = ((CollisionBlockState)blockState).getConstantCollisionShape();