From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Mon, 5 Oct 2020 12:15:14 -0500
Subject: [PATCH] Stonecutter damage


diff --git a/src/main/java/net/minecraft/server/BlockStonecutter.java b/src/main/java/net/minecraft/server/BlockStonecutter.java
index 3e57abd33ee61d78f6d895ec710adb5e5983d42c..08ba9e1c4e916ee09df1bd397b8fc36b4780b9b5 100644
--- a/src/main/java/net/minecraft/server/BlockStonecutter.java
+++ b/src/main/java/net/minecraft/server/BlockStonecutter.java
@@ -71,4 +71,16 @@ public class BlockStonecutter extends Block {
     public boolean a(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition, PathMode pathmode) {
         return false;
     }
+
+    // Purpur start
+    @Override
+    public void stepOn(World world, BlockPosition pos, Entity entity) {
+        if (world.purpurConfig.stonecutterDamage > 0.0F && entity instanceof EntityLiving) {
+            org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
+            entity.damageEntity(DamageSource.CACTUS, world.purpurConfig.stonecutterDamage);
+            org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = null;
+        }
+        super.stepOn(world, pos, entity);
+    }
+    // Purpur end
 }
diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java
index 33804e68931e8b4145b896eedeab79bde78779f2..fabadcd7a21b0e4ad0e2eeadcd8926dfad6c4b7a 100644
--- a/src/main/java/net/minecraft/server/PathfinderNormal.java
+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java
@@ -480,7 +480,7 @@ public class PathfinderNormal extends PathfinderAbstract {
                             return iblockdata.neighbourOverridePathType = PathType.DANGER_CACTUS; // Tuinity - reduce pathfinder branching
                         }
 
-                        if (iblockdata.a(Blocks.SWEET_BERRY_BUSH)) {
+                        if (iblockdata.a(Blocks.SWEET_BERRY_BUSH) || iblockdata.a(Blocks.STONECUTTER)) { // Purpur
                             return iblockdata.neighbourOverridePathType = PathType.DANGER_OTHER; // Tuinity - reduce pathfinder branching
                         }
 
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 3d6e1eb623b66d9157ca33f64483e857e3b6b39e..95d14d82d6f8bce762ef70645f0f8eae3093914c 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -383,6 +383,11 @@ public class PurpurWorldConfig {
         spawnerDeactivateByRedstone = getBoolean("blocks.spawner.deactivate-by-redstone", spawnerDeactivateByRedstone);
     }
 
+    public float stonecutterDamage = 0.0F;
+    private void stonecutterSettings() {
+        stonecutterDamage = (float) getDouble("blocks.stonecutter.damage", stonecutterDamage);
+    }
+
     public boolean turtleEggsBreakFromExpOrbs = true;
     public boolean turtleEggsBreakFromItems = true;
     public boolean turtleEggsBreakFromMinecarts = true;
