Files
Purpur/patches/server/0237-Configurable-farmland-trample-height.patch
granny 4f12f5d3d0 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@4d111a3 Un-experimentalize Entity TP APIs (#9964)
PaperMC/Paper@2182d47 Update mapping-io (#9975)
PaperMC/Paper@9993eb9 Updates documentation in EntityEquipment.java (#9992)
PaperMC/Paper@2184fbc Log correct recipes and advancement count on server start (#9978)
PaperMC/Paper@8bda1f7 Remove unnecessary durability check in ItemStack#isSimilar (#9979)
PaperMC/Paper@977a729 [ci skip] Correct Windows requiring path to gradlew (#9976)
PaperMC/Paper@3766afa [ci skip] Add mention of FQ imports (#9994)
PaperMC/Paper@40872ec Fix CraftMetaItem#addAttributeModifier duplication check (#9995)
PaperMC/Paper@ffa4115 Configurable Dry and Wet Farmland Tick Rates (#9968)
PaperMC/Paper@37bee09 Restore vanilla entity drops behavior (#7650)
PaperMC/Paper@5cbd535 Fix Mushroom cow stew api (#9934)
PaperMC/Paper@8e061ce Add Structure check API (#9062)
PaperMC/Paper@9271ee7 Dont resend blocks on interactions (#9413)
PaperMC/Paper@931781c [ci skip] rebuild patches
2023-12-06 16:18:27 -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 84107011175b6e58b463d5d1b716a3262be0db77..856099241737c43b8213ccc203ef6bb7b7667b1f 100644
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
@@ -103,7 +103,7 @@ public class FarmBlock extends Block {
@Override
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.isClientSide && world.random.nextFloat() < fallDistance - 0.5F && entity instanceof LivingEntity && (entity instanceof Player || world.purpurConfig.farmlandBypassMobGriefing || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) { // Purpur
+ if (!world.isClientSide && (world.purpurConfig.farmlandTrampleHeight >= 0D ? fallDistance >= world.purpurConfig.farmlandTrampleHeight : world.random.nextFloat() < fallDistance - 0.5F) && entity instanceof LivingEntity && (entity instanceof Player || world.purpurConfig.farmlandBypassMobGriefing || world.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 04bccaa4fe7e81a8f82f567bfb2a9bb838961ff4..4c4c5c853eb8a840e76af9aacd73a26e83aaf6f4 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -889,6 +889,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);
@@ -896,6 +897,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;