From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: 12emin34 <macanovic.emin@gmail.com>
Date: Thu, 29 Apr 2021 23:56:02 +0200
Subject: [PATCH] Config for changing the blocks that turn into dirt paths


diff --git a/src/main/java/net/minecraft/world/item/ShovelItem.java b/src/main/java/net/minecraft/world/item/ShovelItem.java
index e5562b407bba35ab93bf8bc3c22ac9d45e8353cb..c688bb73cd062f36524cfc231cb691f29f7998c2 100644
--- a/src/main/java/net/minecraft/world/item/ShovelItem.java
+++ b/src/main/java/net/minecraft/world/item/ShovelItem.java
@@ -33,7 +33,7 @@ public class ShovelItem extends DiggerItem {
             return InteractionResult.PASS;
         } else {
             Player player = context.getPlayer();
-            BlockState blockState2 = FLATTENABLES.get(blockState.getBlock());
+            BlockState blockState2 = level.purpurConfig.shovelTurnsBlockToGrassPath.contains(blockState.getBlock()) ? Blocks.DIRT_PATH.defaultBlockState() : null; // Purpur
             BlockState blockState3 = null;
             if (blockState2 != null && level.getBlockState(blockPos.above()).isAir()) {
                 level.playSound(player, blockPos, SoundEvents.SHOVEL_FLATTEN, SoundSource.BLOCKS, 1.0F, 1.0F);
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 9bfc999e79f7af108ed13558be0dba178fe21107..cdbba64e789485bc719a3ac6e19fd3e1d807f712 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -397,6 +397,21 @@ public class PurpurWorldConfig {
         snowballProjectileOffset = getDouble("gameplay-mechanics.projectile-offset.snowball", snowballProjectileOffset);
     }
 
+    public List<Block> shovelTurnsBlockToGrassPath = new ArrayList<>();
+    private void shovelSettings() {
+        getList("gameplay-mechanics.shovel-turns-block-to-grass-path", new ArrayList<String>(){{
+            add("minecraft:coarse_dirt");
+            add("minecraft:dirt");
+            add("minecraft:grass_block");
+            add("minecraft:mycelium");
+            add("minecraft:podzol");
+            add("minecraft:rooted_dirt");
+        }}).forEach(key -> {
+            Block block = Registry.BLOCK.get(new ResourceLocation(key.toString()));
+            if (block != Blocks.AIR) shovelTurnsBlockToGrassPath.add(block);
+        });
+    }
+
     public boolean silkTouchEnabled = false;
     public String silkTouchSpawnerName = "Spawner";
     public List<String> silkTouchSpawnerLore = new ArrayList<>();
