Entities spawn fixes

This commit is contained in:
paulevsGitch 2020-12-14 19:53:46 +03:00
parent e17271d1dd
commit 24b4b722c2
3 changed files with 17 additions and 3 deletions

View file

@ -21,7 +21,7 @@ public class HostileEntityMixin {
@Inject(method = "canSpawnInDark", at = @At(value = "RETURN"), cancellable = true)
private static void endermenCheck(EntityType<? extends HostileEntity> type, ServerWorldAccess serverWorldAccess, SpawnReason spawnReason, BlockPos pos, Random random, CallbackInfoReturnable<Boolean> info) {
boolean canSpawn = info.getReturnValue();
if (canSpawn && spawnReason == SpawnReason.NATURAL) {
if (canSpawn && spawnReason == SpawnReason.NATURAL && type == EntityType.ENDERMAN) {
Box box = new Box(pos).expand(16);
List<EndermanEntity> entities = serverWorldAccess.getEntitiesByClass(EndermanEntity.class, box, (entity) -> { return true; });
info.setReturnValue(entities.size() < 6);