From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Yive <admin@yive.me>
Date: Sat, 14 Nov 2020 08:06:20 -0800
Subject: [PATCH] Ability to re-add farmland mechanics from Alpha


diff --git a/src/main/java/net/minecraft/server/BlockSoil.java b/src/main/java/net/minecraft/server/BlockSoil.java
index 8dd48669c29dd51ed4d535dad0b0319f4bb2250c..099e0d3df219408ebe2a741a02e53eb9f7def28e 100644
--- a/src/main/java/net/minecraft/server/BlockSoil.java
+++ b/src/main/java/net/minecraft/server/BlockSoil.java
@@ -90,6 +90,14 @@ public class BlockSoil extends Block {
                 return;
             }
 
+            // Purpur start
+            if (world.purpurConfig.farmlandAlpha) {
+                Block block = world.getType(blockposition.down()).getBlock();
+                if (block instanceof BlockFence || block instanceof BlockCobbleWall) {
+                    return;
+                }
+            }
+            // Purpur end
             if (CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.DIRT.getBlockData()).isCancelled()) {
                 return;
             }
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 0cae636df21d73f88acc4dbbf7563cf8a44c5a58..9f8d9b65b151149720ce2d69299ddd0bbe0045d1 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -347,8 +347,10 @@ public class PurpurWorldConfig {
     }
 
     public boolean farmlandGetsMoistFromBelow = false;
+    public boolean farmlandAlpha = false;
     private void farmlandSettings() {
         farmlandGetsMoistFromBelow = getBoolean("blocks.farmland.gets-moist-from-below", farmlandGetsMoistFromBelow);
+        farmlandAlpha = getBoolean("blocks.farmland.use-alpha-farmland", farmlandAlpha);
     }
 
     public boolean furnaceInfiniteFuel = false;
