From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sat, 23 Nov 2019 17:55:42 -0600
Subject: [PATCH] Implement infinite lava


diff --git a/src/main/java/net/minecraft/world/level/material/FluidTypeFlowing.java b/src/main/java/net/minecraft/world/level/material/FluidTypeFlowing.java
index b14b0134b42aa6d1eb285aa453ec6067cc702878..46187d18f797f834deef3685c857e88a8c4f5659 100644
--- a/src/main/java/net/minecraft/world/level/material/FluidTypeFlowing.java
+++ b/src/main/java/net/minecraft/world/level/material/FluidTypeFlowing.java
@@ -226,7 +226,7 @@ public abstract class FluidTypeFlowing extends FluidType {
             }
         }
 
-        if (this.f() && j >= 2) {
+        if (infinite(iworldreader) && j >= getRequiredSources(iworldreader)) { // Purpur
             IBlockData iblockdata2 = iworldreader.getType(blockposition.down());
             Fluid fluid1 = iblockdata2.getFluid();
 
@@ -322,6 +322,17 @@ public abstract class FluidTypeFlowing extends FluidType {
         return (Fluid) this.e().h().set(FluidTypeFlowing.FALLING, flag);
     }
 
+    // Purpur start
+    protected boolean infinite(IWorldReader iworldreader) {
+        return infinite();
+    }
+
+    protected int getRequiredSources(IWorldReader iworldreader) {
+        return 2;
+    }
+    // Purpur end
+
+    protected boolean infinite() { return f(); } // Purpur - OBFHELPER
     protected abstract boolean f();
 
     protected void a(GeneratorAccess generatoraccess, BlockPosition blockposition, IBlockData iblockdata, EnumDirection enumdirection, Fluid fluid) {
diff --git a/src/main/java/net/minecraft/world/level/material/FluidTypeLava.java b/src/main/java/net/minecraft/world/level/material/FluidTypeLava.java
index b362a728b5d17256768847ab09e2505a9cc1918b..86f2e969d98c833700f0f48baf7610ad95b3f8a1 100644
--- a/src/main/java/net/minecraft/world/level/material/FluidTypeLava.java
+++ b/src/main/java/net/minecraft/world/level/material/FluidTypeLava.java
@@ -163,6 +163,18 @@ public abstract class FluidTypeLava extends FluidTypeFlowing {
         generatoraccess.triggerEffect(1501, blockposition, 0);
     }
 
+    // Purpur start
+    @Override
+    protected boolean infinite(IWorldReader iworldreader) {
+        return iworldreader.getWorldBorder().world.purpurConfig.lavaInfinite;
+    }
+
+    @Override
+    protected int getRequiredSources(IWorldReader iworldreader) {
+        return iworldreader.getWorldBorder().world.purpurConfig.lavaInfiniteRequiredSources;
+    }
+    // Purpur end
+
     @Override
     protected boolean f() {
         return false;
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 81f0538f6e5ab48a07459b102ea1f4533a63d031..29bb808b1efe392157971a1a21c66eb9b85579d8 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -158,6 +158,13 @@ public class PurpurWorldConfig {
         farmlandGetsMoistFromBelow = getBoolean("blocks.farmland.gets-moist-from-below", farmlandGetsMoistFromBelow);
     }
 
+    public boolean lavaInfinite = false;
+    public int lavaInfiniteRequiredSources = 2;
+    private void lavaSettings() {
+        lavaInfinite = getBoolean("blocks.lava.infinite-source", lavaInfinite);
+        lavaInfiniteRequiredSources = getInt("blocks.lava.infinite-required-sources", lavaInfiniteRequiredSources);
+    }
+
     public boolean signAllowColors = false;
     public boolean signRightClickEdit = false;
     private void signSettings() {
