feat(mobs/bee): Add can-instantly-start-drowning option, defaults to true

If enabled, this will stop bees from instantly taking damage the moment they begin touching water. Bees can still "drown" with this option disabled when they run out of air.

Relevant: #1639
This commit is contained in:
granny
2025-02-02 18:22:29 -08:00
parent 65637fa648
commit 16cfd04b6c
4 changed files with 49 additions and 27 deletions

View File

@@ -1,5 +1,14 @@
--- a/net/minecraft/world/entity/animal/Bee.java
+++ b/net/minecraft/world/entity/animal/Bee.java
@@ -163,7 +_,7 @@
// Paper end - Fix MC-167279
this.lookControl = new Bee.BeeLookControl(this);
this.setPathfindingMalus(PathType.DANGER_FIRE, -1.0F);
- this.setPathfindingMalus(PathType.WATER, -1.0F);
+ if (this.level().purpurConfig.beeCanInstantlyStartDrowning) this.setPathfindingMalus(PathType.WATER, -1.0F); // Purpur - bee can instantly start drowning in water option
this.setPathfindingMalus(PathType.WATER_BORDER, 16.0F);
this.setPathfindingMalus(PathType.COCOA, -1.0F);
this.setPathfindingMalus(PathType.FENCE, -1.0F);
@@ -365,7 +_,7 @@
}
@@ -9,6 +18,15 @@
}
public void setStayOutOfHiveCountdown(int stayOutOfHiveCountdown) {
@@ -388,7 +_,7 @@
@Override
protected void customServerAiStep(ServerLevel level) {
boolean hasStung = this.hasStung();
- if (this.isInWaterOrBubble()) {
+ if (this.level().purpurConfig.beeCanInstantlyStartDrowning && this.isInWaterOrBubble()) { // Purpur - bee can instantly start drowning in water option
this.underWaterTicks++;
} else {
this.underWaterTicks = 0;
@@ -398,6 +_,7 @@
this.hurtServer(level, this.damageSources().drown(), 1.0F);
}