mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@850b736 Close PRs opened from orgs or bot accounts (#10281) PaperMC/Paper@54a2340 check if itemstack is stackable first (#10285) PaperMC/Paper@9c4bb0d add rich message component support to configuration (#10225) PaperMC/Paper@8870d22 Fire EntityDamageByEntityEvent for unowned wither skulls patch (#10244) PaperMC/Paper@bbc03d8 improve BanList types (#10239) PaperMC/Paper@ce5c8dd Configurable max block/fluid ticks (#10266) PaperMC/Paper@880fef7 Deprecate extra ban methods with raw BanEntry (#9580) PaperMC/Paper@60218cd Don't tick empty worlds (#9025) PaperMC/Paper@b21eb4d add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta (#10245) PaperMC/Paper@89d51d5 Allow enabling sand duping (#10191) PaperMC/Paper@6ad63fb Per world ticks per spawn settings (#6891)
57 lines
3.7 KiB
Diff
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 00a6aa924e47e18ae80b57e9fe1d38e2de15dd72..0c39126ce51439cce05747161aba43bce33a12d8 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
|
@@ -110,7 +110,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 278cc18842f83b8a997dd3fa43449fb90660693c..52b08015601eb266719c907f4dbed4a0ce8af072 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -959,6 +959,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);
|
|
@@ -966,6 +967,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;
|