Option to disable turtle egg trampling with feather falling

This commit is contained in:
12emin34
2025-01-12 14:55:07 -08:00
committed by granny
parent b947caf957
commit 20b77f1368
3 changed files with 9 additions and 43 deletions

View File

@@ -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<ItemStack> 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);

View File

@@ -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;