From 20b77f13685a2ce81d12723c4750052cc05b7917 Mon Sep 17 00:00:00 2001 From: 12emin34 Date: Sun, 12 Jan 2025 14:55:07 -0800 Subject: [PATCH] Option to disable turtle egg trampling with feather falling --- ...e-turtle-egg-trampling-with-feather-.patch | 42 ------------------- .../level/block/TurtleEggBlock.java.patch | 8 +++- .../purpurmc/purpur/PurpurWorldConfig.java | 2 + 3 files changed, 9 insertions(+), 43 deletions(-) delete mode 100644 patches/server/0235-Option-to-disable-turtle-egg-trampling-with-feather-.patch diff --git a/patches/server/0235-Option-to-disable-turtle-egg-trampling-with-feather-.patch b/patches/server/0235-Option-to-disable-turtle-egg-trampling-with-feather-.patch deleted file mode 100644 index 9e57f6c20..000000000 --- a/patches/server/0235-Option-to-disable-turtle-egg-trampling-with-feather-.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: 12emin34 -Date: Mon, 9 May 2022 23:18:09 +0200 -Subject: [PATCH] Option to disable turtle egg trampling with feather falling - - -diff --git a/net/minecraft/world/level/block/TurtleEggBlock.java b/net/minecraft/world/level/block/TurtleEggBlock.java -index 6f02cec4384382569ad7d7c830dd6349aeac5293..cf86448e2067712863d30c9aecc48daedefd227f 100644 ---- a/net/minecraft/world/level/block/TurtleEggBlock.java -+++ b/net/minecraft/world/level/block/TurtleEggBlock.java -@@ -220,6 +220,12 @@ public class TurtleEggBlock extends Block { - if (!(entity instanceof LivingEntity)) { - return false; - } -+ // Purpur start - Option to disable turtle egg trampling with feather falling -+ if (world.purpurConfig.turtleEggsTramplingFeatherFalling) { -+ java.util.Iterator armor = ((LivingEntity) entity).getArmorSlots().iterator(); -+ return !armor.hasNext() || net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.FEATHER_FALLING, armor.next()) < (int) entity.fallDistance; -+ } -+ // Purpur end - Option to disable turtle egg trampling with feather falling - if (entity instanceof Player) return true; - - return world.purpurConfig.turtleEggsBypassMobGriefing ^ world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // Purpur - Add mobGriefing bypass to everything affected -diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 1290e73e4e741e7530481885994f16c2fd5db32c..7cdcea1f5170bc095b365f126a05cb4a6ca70087 100644 ---- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -@@ -1058,12 +1058,14 @@ public class PurpurWorldConfig { - public boolean turtleEggsBreakFromMinecarts = false; - public boolean turtleEggsBypassMobGriefing = false; - public int turtleEggsRandomTickCrackChance = 500; -+ public boolean turtleEggsTramplingFeatherFalling = false; - private void turtleEggSettings() { - turtleEggsBreakFromExpOrbs = getBoolean("blocks.turtle_egg.break-from-exp-orbs", turtleEggsBreakFromExpOrbs); - turtleEggsBreakFromItems = getBoolean("blocks.turtle_egg.break-from-items", turtleEggsBreakFromItems); - turtleEggsBreakFromMinecarts = getBoolean("blocks.turtle_egg.break-from-minecarts", turtleEggsBreakFromMinecarts); - turtleEggsBypassMobGriefing = getBoolean("blocks.turtle_egg.bypass-mob-griefing", turtleEggsBypassMobGriefing); - turtleEggsRandomTickCrackChance = getInt("blocks.turtle_egg.random-tick-crack-chance", turtleEggsRandomTickCrackChance); -+ turtleEggsTramplingFeatherFalling = getBoolean("blocks.turtle_egg.feather-fall-distance-affects-trampling", turtleEggsTramplingFeatherFalling); - } - - public int waterInfiniteRequiredSources = 2; diff --git a/purpur-server/minecraft-patches/sources/net/minecraft/world/level/block/TurtleEggBlock.java.patch b/purpur-server/minecraft-patches/sources/net/minecraft/world/level/block/TurtleEggBlock.java.patch index 8d0653e77..d6e5654f9 100644 --- a/purpur-server/minecraft-patches/sources/net/minecraft/world/level/block/TurtleEggBlock.java.patch +++ b/purpur-server/minecraft-patches/sources/net/minecraft/world/level/block/TurtleEggBlock.java.patch @@ -9,7 +9,7 @@ } @Override -@@ -192,9 +_,25 @@ +@@ -192,9 +_,31 @@ } private boolean canDestroyEgg(ServerLevel level, Entity entity) { @@ -33,6 +33,12 @@ + if (!(entity instanceof LivingEntity)) { + return false; + } ++ // Purpur start - Option to disable turtle egg trampling with feather falling ++ if (level.purpurConfig.turtleEggsTramplingFeatherFalling) { ++ java.util.Iterator armor = ((LivingEntity) entity).getArmorSlots().iterator(); ++ return !armor.hasNext() || net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.FEATHER_FALLING, armor.next()) < (int) entity.fallDistance; ++ } ++ // Purpur end - Option to disable turtle egg trampling with feather falling + if (entity instanceof Player) return true; + + return level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); diff --git a/purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java index affc4ac1d..c74bcbe99 100644 --- a/purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -1057,12 +1057,14 @@ public class PurpurWorldConfig { public boolean turtleEggsBreakFromMinecarts = false; public boolean turtleEggsBypassMobGriefing = false; public int turtleEggsRandomTickCrackChance = 500; + public boolean turtleEggsTramplingFeatherFalling = false; private void turtleEggSettings() { turtleEggsBreakFromExpOrbs = getBoolean("blocks.turtle_egg.break-from-exp-orbs", turtleEggsBreakFromExpOrbs); turtleEggsBreakFromItems = getBoolean("blocks.turtle_egg.break-from-items", turtleEggsBreakFromItems); turtleEggsBreakFromMinecarts = getBoolean("blocks.turtle_egg.break-from-minecarts", turtleEggsBreakFromMinecarts); turtleEggsBypassMobGriefing = getBoolean("blocks.turtle_egg.bypass-mob-griefing", turtleEggsBypassMobGriefing); turtleEggsRandomTickCrackChance = getInt("blocks.turtle_egg.random-tick-crack-chance", turtleEggsRandomTickCrackChance); + turtleEggsTramplingFeatherFalling = getBoolean("blocks.turtle_egg.feather-fall-distance-affects-trampling", turtleEggsTramplingFeatherFalling); } public int waterInfiniteRequiredSources = 2;