From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ben Kerllenevich <me@notom3ga.me>
Date: Sun, 21 Mar 2021 15:26:52 -0400
Subject: [PATCH] Drowning Settings


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index d321616b7f726f4ff307b46ced9efce6cc20b82f..c20787a20cf6f273092d2b7ef0d7d90abcfdf609 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2575,7 +2575,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
     }
 
     public int getDefaultPortalCooldown() {
-        return 300;
+        return this.world.purpurConfig.drowningAirTicks; // Purpur
     }
 
     public Iterable<ItemStack> bn() {
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
index cbfaa40c327fefe416c4c751846bcf278a36144a..be709c961cd85c1db32fb49c71c63814cbe6bd23 100644
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
@@ -394,7 +394,7 @@ public abstract class EntityLiving extends Entity {
             if (this.a((Tag) TagsFluid.WATER) && !this.world.getType(new BlockPosition(this.locX(), this.getHeadY(), this.locZ())).a(Blocks.BUBBLE_COLUMN)) {
                 if (!this.canBreatheUnderwater() && !MobEffectUtil.c(this) && !flag1) {  // Paper - use OBFHELPER so it can be overridden
                     this.setAirTicks(this.l(this.getAirTicks()));
-                    if (this.getAirTicks() == -20) {
+                    if (this.getAirTicks() == -this.world.purpurConfig.drowningDamageInterval) { // Purpur
                         this.setAirTicks(0);
                         Vec3D vec3d = this.getMot();
 
@@ -406,7 +406,7 @@ public abstract class EntityLiving extends Entity {
                             this.world.addParticle(Particles.BUBBLE, this.locX() + d2, this.locY() + d3, this.locZ() + d4, vec3d.x, vec3d.y, vec3d.z);
                         }
 
-                        this.damageEntity(DamageSource.DROWN, 2.0F);
+                        this.damageEntity(DamageSource.DROWN, (float) this.world.purpurConfig.damageFromDrowning); // Purpur
                     }
                 }
 
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index e17bf229f8bca03f5a2c78203d1e95093ff9bac1..c09c3a326e6ea80f3037a3d9fd6b78f03d8a7ecd 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -2001,6 +2001,15 @@ public class PurpurWorldConfig {
         imposeTeleportRestrictionsOnGateways = getBoolean("gameplay-mechanics.impose-teleport-restrictions-on-gateways", imposeTeleportRestrictionsOnGateways);
     }
 
+    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 boolean baselessCrystalExplode = true;
     public double baselessCrystalExplosionPower = 6.0D;
     public boolean baselessCrystalExplosionFire = false;
