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/world/level/block/BlockSoil.java b/src/main/java/net/minecraft/world/level/block/BlockSoil.java
index 2bbaa2fb426869223a9b2f07406496c1b0daff3f..3e8893bf76b8ffda4c595c81086556ea929beaa4 100644
--- a/src/main/java/net/minecraft/world/level/block/BlockSoil.java
+++ b/src/main/java/net/minecraft/world/level/block/BlockSoil.java
@@ -113,6 +113,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 938876a4edb3b37e6b7dcc3b2c1b55cd35df1c8e..6d18cc40841c285664fbb0964ba0ecc30994fc5c 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -359,8 +359,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;
