Add null check to level ref in Entity constructor ()

This commit is contained in:
Dylan
2025-03-03 08:46:20 -08:00
committed by GitHub
parent 1d5e5a57e9
commit 8de7e356fa

@@ -192,7 +192,7 @@
this.entityData = builder.build(); this.entityData = builder.build();
this.setPos(0.0, 0.0, 0.0); this.setPos(0.0, 0.0, 0.0);
this.eyeHeight = this.dimensions.eyeHeight(); this.eyeHeight = this.dimensions.eyeHeight();
+ this.despawnTime = type == EntityType.PLAYER ? -1 : level.paperConfig().entities.spawning.despawnTime.getOrDefault(type, io.papermc.paper.configuration.type.number.IntOr.Disabled.DISABLED).or(-1); // Paper - entity despawn time limit + this.despawnTime = level == null || type == EntityType.PLAYER ? -1 : level.paperConfig().entities.spawning.despawnTime.getOrDefault(type, io.papermc.paper.configuration.type.number.IntOr.Disabled.DISABLED).or(-1); // Paper - entity despawn time limit
} }
public boolean isColliding(BlockPos pos, BlockState state) { public boolean isColliding(BlockPos pos, BlockState state) {