[Fixes] Disabling end entities result in crashes (by Necrontyrr)

Merge pull request #112 from Necrontyrr/disable-spawn
This commit is contained in:
Frank 2022-11-18 19:24:59 +01:00 committed by GitHub
commit d15d2e86ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 27 additions and 27 deletions

View file

@ -82,13 +82,13 @@ public class SilkMothHiveBlock extends BaseBlock {
if (!world.getBlockState(spawn).isAir()) {
return;
}
int count = world.getEntities(EndEntities.SILK_MOTH, new AABB(pos).inflate(16), (entity) -> {
int count = world.getEntities(EndEntities.SILK_MOTH.type(), new AABB(pos).inflate(16), (entity) -> {
return true;
}).size();
if (count > 6) {
return;
}
SilkMothEntity moth = new SilkMothEntity(EndEntities.SILK_MOTH, world);
SilkMothEntity moth = new SilkMothEntity(EndEntities.SILK_MOTH.type(), world);
moth.moveTo(spawn.getX() + 0.5, spawn.getY() + 0.5, spawn.getZ() + 0.5, dir.toYRot(), 0);
moth.setDeltaMovement(new Vec3(dir.getStepX() * 0.4, 0, dir.getStepZ() * 0.4));
moth.setHive(world, pos);

View file

@ -149,13 +149,13 @@ public class SilkMothNestBlock extends BaseBlock implements RenderLayerProvider
if (!world.getBlockState(spawn).isAir()) {
return;
}
int count = world.getEntities(EndEntities.SILK_MOTH, new AABB(pos).inflate(16), (entity) -> {
int count = world.getEntities(EndEntities.SILK_MOTH.type(), new AABB(pos).inflate(16), (entity) -> {
return true;
}).size();
if (count > 6) {
return;
}
SilkMothEntity moth = new SilkMothEntity(EndEntities.SILK_MOTH, world);
SilkMothEntity moth = new SilkMothEntity(EndEntities.SILK_MOTH.type(), world);
moth.moveTo(spawn.getX() + 0.5, spawn.getY() + 0.5, spawn.getZ() + 0.5, dir.toYRot(), 0);
moth.setDeltaMovement(new Vec3(dir.getStepX() * 0.4, 0, dir.getStepZ() * 0.4));
moth.setHive(world, pos);