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

@@ -1,42 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Sun, 22 Nov 2020 22:17:53 -0800
Subject: [PATCH] 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.
diff --git a/net/minecraft/world/entity/monster/EnderMan.java b/net/minecraft/world/entity/monster/EnderMan.java
index d2959976cf206f6c92ae90f103035e4760b9d955..c816521a5f73ccd04216ac0225945c6ef585869d 100644
--- a/net/minecraft/world/entity/monster/EnderMan.java
+++ b/net/minecraft/world/entity/monster/EnderMan.java
@@ -468,7 +468,7 @@ public class EnderMan extends Monster implements NeutralMob {
@Override
public boolean requiresCustomPersistence() {
- return super.requiresCustomPersistence() || this.getCarriedBlock() != null;
+ return super.requiresCustomPersistence() || (!this.level().purpurConfig.endermanDespawnEvenWithBlock && this.getCarriedBlock() != null); // Purpur
}
private static class EndermanFreezeWhenLookedAt extends Goal {
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index c6f4b6e14616aed688269c56aa9ddf11f097abaf..cdcc44e381dee9189f951e3f1984272b0f0f60b0 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -862,6 +862,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);
@@ -874,6 +875,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;

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;