Files
Purpur/patches/server/0226-Configurable-farmland-trample-height.patch
granny 7f6f667142 Updated Upstream (Pufferfish)
Upstream has released updates that appear to apply and compile correctly

Pufferfish Changes:
pufferfish-gg/Pufferfish@f05b0e9 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@9a82b86 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@c6ec7a0 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@c789f72 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@9ddaa1a Updated Upstream (Paper)
pufferfish-gg/Pufferfish@3554f78 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@a9e9d99 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@09a2f81 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@63ce67d Updated Upstream (Paper)
pufferfish-gg/Pufferfish@8abd47b Updated Upstream (Paper)
pufferfish-gg/Pufferfish@3415da0 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@cfa3c61 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@0a8641d 1.21.3 Update
pufferfish-gg/Pufferfish@784d72f Updated Upstream (Paper)
pufferfish-gg/Pufferfish@40e1ad0 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@95ef348 Make iterator counting in IteratorSafeOrderedReferenceSet thread-safe for async mob spawning (#109)
pufferfish-gg/Pufferfish@34c0042 Updated Upstream (Paper)
2024-11-30 20:49:52 -08:00

57 lines
3.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@Gmail.com>
Date: Tue, 4 Jan 2022 11:56:48 -0600
Subject: [PATCH] Configurable farmland trample height
This is _not_ in block height or an exact science.
During my testing I found very inconsistent values
for the fallDistance variable. Here are the results
of those tests (https://imgur.com/BojltJF):
Value set -> Actual fall distance needed to trample
1.0 -> 1.25
1.5 -> 1.75
2.0 -> 2.25
2.5 -> 2.87
3.0 -> 3.5
3.5 -> 4.25
4.0 -> 4.25
4.5 -> 5.0
5.0 -> 5.87
5.5 -> 5.87
6.0 -> 6.75
diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
index af135f8b70b0e2af470afce9053976c3a1e03477..eaac00e2534aca4eab92c7b9f9248e04b35b47df 100644
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
@@ -112,7 +112,7 @@ public class FarmBlock extends Block {
public void fallOn(Level world, BlockState state, BlockPos pos, Entity entity, float fallDistance) {
super.fallOn(world, state, pos, entity, fallDistance); // CraftBukkit - moved here as game rules / events shouldn't affect fall damage.
if (world instanceof ServerLevel worldserver) {
- if (world.random.nextFloat() < fallDistance - 0.5F && entity instanceof LivingEntity && (entity instanceof Player || worldserver.purpurConfig.farmlandBypassMobGriefing ^ worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) { // Purpur
+ if ((worldserver.purpurConfig.farmlandTrampleHeight >= 0D ? fallDistance >= worldserver.purpurConfig.farmlandTrampleHeight : world.random.nextFloat() < fallDistance - 0.5F) && entity instanceof LivingEntity && (entity instanceof Player || worldserver.purpurConfig.farmlandBypassMobGriefing ^ worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) { // Purpur
// CraftBukkit start - Interact soil
org.bukkit.event.Cancellable cancellable;
if (entity instanceof Player) {
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 01306ed51e4ca205bc58c171e6df5594c96aa22e..529e8a930ca9e01cfdfd1e7c15027d85e7f8076d 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -927,6 +927,7 @@ public class PurpurWorldConfig {
public boolean farmlandTramplingDisabled = false;
public boolean farmlandTramplingOnlyPlayers = false;
public boolean farmlandTramplingFeatherFalling = false;
+ public double farmlandTrampleHeight = -1D;
private void farmlandSettings() {
farmlandBypassMobGriefing = getBoolean("blocks.farmland.bypass-mob-griefing", farmlandBypassMobGriefing);
farmlandGetsMoistFromBelow = getBoolean("blocks.farmland.gets-moist-from-below", farmlandGetsMoistFromBelow);
@@ -934,6 +935,7 @@ public class PurpurWorldConfig {
farmlandTramplingDisabled = getBoolean("blocks.farmland.disable-trampling", farmlandTramplingDisabled);
farmlandTramplingOnlyPlayers = getBoolean("blocks.farmland.only-players-trample", farmlandTramplingOnlyPlayers);
farmlandTramplingFeatherFalling = getBoolean("blocks.farmland.feather-fall-distance-affects-trampling", farmlandTramplingFeatherFalling);
+ farmlandTrampleHeight = getDouble("blocks.farmland.trample-height", farmlandTrampleHeight);
}
public double floweringAzaleaGrowthChance = 0.0D;