only set max air ticks when initializing entity, closes #1745

This commit is contained in:
granny
2026-01-03 19:16:45 -08:00
parent b31491f7a8
commit bce71abdde
2 changed files with 15 additions and 14 deletions

View File

@@ -75,10 +75,10 @@ index 5af26990d6cce42c3c12ac6d896ed3859c3497e3..0e17b54d7c3046cc85d15956793450ff
if (itemType == Items.WATER_BUCKET && target instanceof net.minecraft.world.entity.animal.Bucketable && target instanceof LivingEntity && resendData) {
target.resendPossiblyDesyncedEntityData(ServerGamePacketListenerImpl.this.player); // Paper - The entire mob gets deleted, so resend it
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index b4a69c5b17a28ccc9f79d6df21df9ac9714d36ef..902ce8a8d88df536c3194343d44bbe8c1bf7baff 100644
index b9d78afc5f2d1f0b3cffcb50f465bd1d057820ff..09f7026f4b03deef775ce085cafde2a9da69399f 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -3373,6 +3373,13 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
@@ -3374,6 +3374,13 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
this.passengers = ImmutableList.copyOf(list);
}
@@ -92,7 +92,7 @@ index b4a69c5b17a28ccc9f79d6df21df9ac9714d36ef..902ce8a8d88df536c3194343d44bbe8c
}
}
@@ -3413,6 +3420,14 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
@@ -3414,6 +3421,14 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
return false;
}
// CraftBukkit end
@@ -107,7 +107,7 @@ index b4a69c5b17a28ccc9f79d6df21df9ac9714d36ef..902ce8a8d88df536c3194343d44bbe8c
if (this.passengers.size() == 1 && this.passengers.get(0) == passenger) {
this.passengers = ImmutableList.of();
} else {
@@ -5463,4 +5478,44 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
@@ -5464,4 +5479,44 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
return ((ServerLevel) this.level()).isPositionEntityTicking(this.blockPosition());
}
// Paper end - Expose entity id counter

View File

@@ -38,7 +38,7 @@
public void inactiveTick() {
}
@@ -535,10 +_,21 @@
@@ -535,10 +_,22 @@
}
// Paper end - optimise entity tracker
@@ -52,6 +52,7 @@
this.type = type;
this.level = level;
this.dimensions = type.getDimensions();
+ this.maxAirTicks = level == null ? Entity.TOTAL_AIR_SUPPLY : this.level.purpurConfig.drowningAirTicks; // Purpur - Drowning Settings
+ // Purpur start - Add toggle for RNG manipulation
+ this.random = level == null || level.purpurConfig.entitySharedRandom ? SHARED_RANDOM : RandomSource.create();
+ this.uuid = Mth.createInsecureUUID(this.random);
@@ -77,6 +78,15 @@
}
public boolean causeFallDamage(double fallDistance, float damageMultiplier, DamageSource damageSource) {
@@ -2573,7 +_,7 @@
output.putBoolean("Bukkit.invisible", this.persistentInvisibility);
}
// SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
- if (this.maxAirTicks != this.getDefaultMaxAirSupply()) {
+ if (this.maxAirTicks != this.getDefaultMaxAirSupply() && this.getDefaultMaxAirSupply() != this.level().purpurConfig.drowningAirTicks) { // Purpur - Drowning Settings
output.putInt("Bukkit.MaxAirSupply", this.getMaxAirSupply());
}
output.putInt("Spigot.ticksLived", this.totalEntityAge); // Paper
@@ -2660,6 +_,11 @@
output.putBoolean("Paper.FreezeLock", true);
}
@@ -127,15 +137,6 @@
}
}
}
@@ -3686,7 +_,7 @@
}
public int getMaxAirSupply() {
- return this.maxAirTicks; // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
+ return this.level == null? this.maxAirTicks : this.level().purpurConfig.drowningAirTicks; // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir() // Purpur - Drowning Settings
}
public int getAirSupply() {
@@ -4221,7 +_,7 @@
}