Drowning Settings

This commit is contained in:
Ben Kerllenevich
2025-01-11 17:30:41 -08:00
committed by granny
parent fd21066058
commit e364594711
4 changed files with 36 additions and 61 deletions

View File

@@ -67,6 +67,15 @@
}
}
}
@@ -3460,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() {
@@ -3955,7 +_,7 @@
// CraftBukkit end

View File

@@ -13,6 +13,24 @@
this.hurtServer(serverLevel1, this.damageSources().outOfBorder(), Math.max(1, Mth.floor(-d * damagePerBlock)));
}
}
@@ -472,7 +_,7 @@
&& (!flag || !((Player)this).getAbilities().invulnerable);
if (flag1) {
this.setAirSupply(this.decreaseAirSupply(this.getAirSupply()));
- if (this.getAirSupply() == -20) {
+ if (this.getAirSupply() == -this.level().purpurConfig.drowningDamageInterval) { // Purpur - Drowning Settings
this.setAirSupply(0);
Vec3 deltaMovement = this.getDeltaMovement();
@@ -492,7 +_,7 @@
);
}
- this.hurt(this.damageSources().drown(), 2.0F);
+ this.hurt(this.damageSources().drown(), (float) this.level().purpurConfig.damageFromDrowning); // Purpur - Drowning Settings
}
} else if (this.getAirSupply() < this.getMaxAirSupply()) {
this.setAirSupply(this.increaseAirSupply(this.getAirSupply()));
@@ -1372,6 +_,24 @@
this.stopSleeping();
}

View File

@@ -157,6 +157,15 @@ public class PurpurWorldConfig {
nighttimeTicks = getInt("gameplay-mechanics.daylight-cycle-ticks.nighttime", nighttimeTicks);
}
public int drowningAirTicks = 300;
public int drowningDamageInterval = 20;
public double damageFromDrowning = 2.0F;
private void drowningSettings() {
drowningAirTicks = getInt("gameplay-mechanics.drowning.air-ticks", drowningAirTicks);
drowningDamageInterval = getInt("gameplay-mechanics.drowning.ticks-per-damage", drowningDamageInterval);
damageFromDrowning = getDouble("gameplay-mechanics.drowning.damage-from-drowning", damageFromDrowning);
}
public int elytraDamagePerSecond = 1;
public double elytraDamageMultiplyBySpeed = 0;
public int elytraDamagePerFireworkBoost = 0;