From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ben Kerllenevich <ben@omega24.dev>
Date: Thu, 29 Apr 2021 14:06:29 -0400
Subject: [PATCH] Configurable damage settings for magma blocks


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index b04ce8c54e282eb95b15abf5b928f872233da645..c187e182384cd82bfa085d43ba8010a6ab3f1303 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1027,7 +1027,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
                 }
                 // CraftBukkit end
 
-                if (this.onGround && (!this.isSteppingCarefully() || (block == Blocks.STONECUTTER && level.purpurConfig.stonecutterDamage > 0.0F))) {
+                if (this.onGround && (!this.isSteppingCarefully() || (block == Blocks.STONECUTTER && level.purpurConfig.stonecutterDamage > 0.0F) || (block == Blocks.MAGMA_BLOCK && level.purpurConfig.magmaBlockDamageWhenSneaking))) { // Purpur
                     block.stepOn(this.level, blockposition, iblockdata, this);
                 }
 
diff --git a/src/main/java/net/minecraft/world/level/block/MagmaBlock.java b/src/main/java/net/minecraft/world/level/block/MagmaBlock.java
index 5d844ed98b916298a657d5e9766ab7f383a304e0..0129460ce1ca199a47b6657f824c75fdf0e44ccf 100644
--- a/src/main/java/net/minecraft/world/level/block/MagmaBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/MagmaBlock.java
@@ -29,7 +29,7 @@ public class MagmaBlock extends Block {
 
     @Override
     public void stepOn(Level world, BlockPos pos, BlockState state, Entity entity) {
-        if (!entity.fireImmune() && entity instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity) entity)) {
+        if (!entity.fireImmune() && entity instanceof LivingEntity && (world.purpurConfig.magmaBlockDamageWithFrostWalker || !EnchantmentHelper.hasFrostWalker((LivingEntity) entity))) { // Purpur
             org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()); // CraftBukkit
             entity.hurt(DamageSource.HOT_FLOOR, 1.0F);
             org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = null; // CraftBukkit
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 9e18b2e38b0c36eae8b7e24aedf3c4e6786a7ff0..f21b019e7074b637d2a4f8cc47749023751d2221 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -617,6 +617,13 @@ public class PurpurWorldConfig {
         kelpMaxGrowthAge = getInt("blocks.kelp.max-growth-age", kelpMaxGrowthAge);
     }
 
+    public boolean magmaBlockDamageWhenSneaking = false;
+    public boolean magmaBlockDamageWithFrostWalker = false;
+    private void magmaBlockSettings() {
+        magmaBlockDamageWhenSneaking = getBoolean("blocks.magma-block.damage-when-sneaking", magmaBlockDamageWhenSneaking);
+        magmaBlockDamageWithFrostWalker = getBoolean("blocks.magma-block.damage-with-frost-walker", magmaBlockDamageWithFrostWalker);
+    }
+
     public boolean powderSnowBypassMobGriefing = false;
     private void powderSnowSettings() {
         powderSnowBypassMobGriefing = getBoolean("blocks.powder_snow.bypass-mob-griefing", powderSnowBypassMobGriefing);
