Add config for allowing Endermen to despawn even while holding a block

This should help to reduce the amount of dirt, gravel, grass, and etc. that Endermen like to randomly place all over the world.
This commit is contained in:
Jason Penilla
2025-01-09 20:33:54 -08:00
committed by granny
parent 5055e6adb9
commit 4346cee03f
3 changed files with 11 additions and 42 deletions

View File

@@ -8,6 +8,15 @@
} else {
boolean flag = damageSource.getDirectEntity() instanceof ThrownPotion;
if (!damageSource.is(DamageTypeTags.IS_PROJECTILE) && !flag) {
@@ -440,7 +_,7 @@
@Override
public boolean requiresCustomPersistence() {
- return super.requiresCustomPersistence() || this.getCarriedBlock() != null;
+ return super.requiresCustomPersistence() || (!this.level().purpurConfig.endermanDespawnEvenWithBlock && this.getCarriedBlock() != null); // Purpur - Add config for allowing Endermen to despawn even while holding a block
}
static class EndermanFreezeWhenLookedAt extends Goal {
@@ -484,6 +_,7 @@
@Override

View File

@@ -853,6 +853,7 @@ public class PurpurWorldConfig {
public double endermanMaxHealth = 40.0D;
public double endermanScale = 1.0D;
public boolean endermanAllowGriefing = true;
public boolean endermanDespawnEvenWithBlock = false;
private void endermanSettings() {
endermanRidable = getBoolean("mobs.enderman.ridable", endermanRidable);
endermanRidableInWater = getBoolean("mobs.enderman.ridable-in-water", endermanRidableInWater);
@@ -865,6 +866,7 @@ public class PurpurWorldConfig {
endermanMaxHealth = getDouble("mobs.enderman.attributes.max_health", endermanMaxHealth);
endermanScale = Mth.clamp(getDouble("mobs.enderman.attributes.scale", endermanScale), 0.0625D, 16.0D);
endermanAllowGriefing = getBoolean("mobs.enderman.allow-griefing", endermanAllowGriefing);
endermanDespawnEvenWithBlock = getBoolean("mobs.enderman.can-despawn-with-held-block", endermanDespawnEvenWithBlock);
}
public boolean endermiteRidable = false;