mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 08:57:44 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: 7232d8f2a EntityLoadCrossbowEvent#shouldConsumeItem 4740bd6c8 Mark PlayerInventory#getItem as nullable bd9ace578 Add a config option to limit the number of entities of each type to load/save in a chunk (#4792) 6bafeb5a9 Move logic from last patch into correct place 9668118fd disable entity ticking flag after watchdog obliteration
49 lines
2.9 KiB
Diff
49 lines
2.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Mariell Hoversholm <proximyst@proximyst.com>
|
|
Date: Sat, 9 Jan 2021 16:06:40 +0100
|
|
Subject: [PATCH] Farmland trampling changes
|
|
|
|
This lets us choose if only players may trample farmland.
|
|
|
|
This lets us choose if entities can stop trampling if they fall a
|
|
distance equal to their feather falling level, plus the extra block
|
|
necessary to trample in the first place. Feather Falling 1 requires you
|
|
to fall over 3+ blocks to trample. FF 2 requires 4+, etc.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockSoil.java b/src/main/java/net/minecraft/server/BlockSoil.java
|
|
index 73dc0f499c456c21d298013fbab8c79ebcdecd6b..6b65a4b1845c6770f92ceebd04827595725632b5 100644
|
|
--- a/src/main/java/net/minecraft/server/BlockSoil.java
|
|
+++ b/src/main/java/net/minecraft/server/BlockSoil.java
|
|
@@ -97,6 +97,12 @@ public class BlockSoil extends Block {
|
|
return;
|
|
}
|
|
}
|
|
+ if (world.purpurConfig.farmlandTramplingOnlyPlayers && !(entity instanceof EntityPlayer)) return;
|
|
+ if (world.purpurConfig.farmlandTramplingFeatherFalling) {
|
|
+ Iterator<ItemStack> armor = entity.getArmorItems().iterator();
|
|
+ if (armor.hasNext() && EnchantmentManager.getEnchantmentLevel(Enchantments.PROTECTION_FALL, armor.next()) >= (int) entity.fallDistance)
|
|
+ return;
|
|
+ }
|
|
// Purpur end
|
|
if (CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.DIRT.getBlockData()).isCancelled()) {
|
|
return;
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index f5fd4ac62c4e2b300930356a7f5735e76f16f8a4..0fce0eb902393e28b18b06bea09558f7b5793e0a 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -395,10 +395,14 @@ public class PurpurWorldConfig {
|
|
public boolean farmlandBypassMobGriefing = false;
|
|
public boolean farmlandGetsMoistFromBelow = false;
|
|
public boolean farmlandAlpha = false;
|
|
+ public boolean farmlandTramplingOnlyPlayers = false;
|
|
+ public boolean farmlandTramplingFeatherFalling = false;
|
|
private void farmlandSettings() {
|
|
farmlandBypassMobGriefing = getBoolean("blocks.farmland.bypass-mob-griefing", farmlandBypassMobGriefing);
|
|
farmlandGetsMoistFromBelow = getBoolean("blocks.farmland.gets-moist-from-below", farmlandGetsMoistFromBelow);
|
|
farmlandAlpha = getBoolean("blocks.farmland.use-alpha-farmland", farmlandAlpha);
|
|
+ farmlandTramplingOnlyPlayers = getBoolean("blocks.farmland.only-players-trample", farmlandTramplingOnlyPlayers);
|
|
+ farmlandTramplingFeatherFalling = getBoolean("blocks.farmland.feather-fall-distance-affects-trampling", farmlandTramplingFeatherFalling);
|
|
}
|
|
|
|
public boolean furnaceInfiniteFuel = false;
|