Tweak search ranges for the butterfly ai

This commit is contained in:
Sollace 2023-01-29 14:25:57 +00:00
parent 8a13b02809
commit 71e6b4ac16

View file

@ -177,7 +177,7 @@ public class ButterflyEntity extends AmbientEntity {
} }
if (world.getBlockState(below).isAir() if (world.getBlockState(below).isAir()
|| !world.getOtherEntities(this, getBoundingBox().expand(7), this::isAggressor).isEmpty() || !world.getOtherEntities(this, getBoundingBox().expand(3), this::isAggressor).isEmpty()
|| (ticksResting++ > MAX_REST_TICKS || world.random.nextInt(500) == 0) || (ticksResting++ > MAX_REST_TICKS || world.random.nextInt(500) == 0)
|| world.hasRain(below)) { || world.hasRain(below)) {
setResting(false); setResting(false);
@ -212,7 +212,7 @@ public class ButterflyEntity extends AmbientEntity {
} }
private boolean canBreed() { private boolean canBreed() {
return age > BREEDING_INTERVAL && breedingCooldown <= 0 && isResting() && world.getOtherEntities(this, getBoundingBox().expand(20), i -> { return age > BREEDING_INTERVAL && breedingCooldown <= 0 && isResting() && world.getOtherEntities(this, getBoundingBox().expand(2), i -> {
return i instanceof ButterflyEntity && i.getType() == getType() && ((ButterflyEntity)i).isResting(); return i instanceof ButterflyEntity && i.getType() == getType() && ((ButterflyEntity)i).isResting();
}).size() == 1; }).size() == 1;
} }