From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Encode42 <me@encode42.dev>
Date: Wed, 24 Mar 2021 20:30:37 -0400
Subject: [PATCH] Configurable sponge absorption

Allows the total area and radius of water blocks the sponge can absorb to be changed.

diff --git a/src/main/java/net/minecraft/world/level/block/BlockSponge.java b/src/main/java/net/minecraft/world/level/block/BlockSponge.java
index d80eee47390ab202eea0368571421bbc94655ab1..b36536d4cc95797c59549f5db1f67b34ff7b9be2 100644
--- a/src/main/java/net/minecraft/world/level/block/BlockSponge.java
+++ b/src/main/java/net/minecraft/world/level/block/BlockSponge.java
@@ -76,13 +76,13 @@ public class BlockSponge extends Block {
                 if (fluid.a((Tag) TagsFluid.WATER)) {
                     if (iblockdata.getBlock() instanceof IFluidSource && ((IFluidSource) iblockdata.getBlock()).removeFluid(blockList, blockposition2, iblockdata) != FluidTypes.EMPTY) { // CraftBukkit
                         ++i;
-                        if (j < 6) {
+                        if (j < world.purpurConfig.spongeAbsorptionRadius) { // Purpur
                             queue.add(new Tuple<>(blockposition2, j + 1));
                         }
                     } else if (iblockdata.getBlock() instanceof BlockFluids) {
                         blockList.setTypeAndData(blockposition2, Blocks.AIR.getBlockData(), 3); // CraftBukkit
                         ++i;
-                        if (j < 6) {
+                        if (j < world.purpurConfig.spongeAbsorptionRadius) { // Purpur
                             queue.add(new Tuple<>(blockposition2, j + 1));
                         }
                     } else if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) {
@@ -93,14 +93,14 @@ public class BlockSponge extends Block {
                         blockList.setTypeAndData(blockposition2, Blocks.AIR.getBlockData(), 3);
                         // CraftBukkit end
                         ++i;
-                        if (j < 6) {
+                        if (j < world.purpurConfig.spongeAbsorptionRadius) { // Purpur
                             queue.add(new Tuple<>(blockposition2, j + 1));
                         }
                     }
                 }
             }
 
-            if (i > 64) {
+            if (i > world.purpurConfig.spongeAbsorptionArea) { // Purpur
                 break;
             }
         }
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index be6637a7de0dc9514af5f0d30e1095c95652e26b..1584d1e5d0ae6adda1ace0fb8abeb9bb92771bed 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -555,6 +555,13 @@ public class PurpurWorldConfig {
         spawnerDeactivateByRedstone = getBoolean("blocks.spawner.deactivate-by-redstone", spawnerDeactivateByRedstone);
     }
 
+    public int spongeAbsorptionArea = 64;
+    public int spongeAbsorptionRadius = 6;
+    private void spongeSettings() {
+        spongeAbsorptionArea = getInt("blocks.sponge.absorption.area", spongeAbsorptionArea);
+        spongeAbsorptionRadius = getInt("blocks.sponge.absorption.radius", spongeAbsorptionRadius);
+    }
+
     public float stonecutterDamage = 0.0F;
     private void stonecutterSettings() {
         stonecutterDamage = (float) getDouble("blocks.stonecutter.damage", stonecutterDamage);
