mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
45 lines
2.9 KiB
Diff
45 lines
2.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: 12emin34 <macanovic.emin@gmail.com>
|
|
Date: Mon, 9 May 2022 23:18:09 +0200
|
|
Subject: [PATCH] Option to disable turtle egg trampling with feather falling
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java
|
|
index 2f0e8aeb9c45853fca12ddd78a7d51813a600e67..08ba90f760abb9fb62311dddd7b5bdbd0d9518d7 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java
|
|
@@ -219,7 +219,13 @@ public class TurtleEggBlock extends Block {
|
|
if (!(entity instanceof LivingEntity)) {
|
|
return false;
|
|
}
|
|
- if (entity instanceof Player) return true;
|
|
+ if (world.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;
|
|
+ }
|
|
+ if (entity instanceof Player) {
|
|
+ return true;
|
|
+ }
|
|
|
|
return world.purpurConfig.turtleEggsBypassMobGriefing || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
|
// Purpur end
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index 7135cf523ac1a6a1ee40c15ef3666f0a578d2917..da4e59b1dba444e9775d5c7137ab9004b4436ead 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -1071,12 +1071,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;
|