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:26c37d99d5create random seeds for features using SecureRandom589bf2f1bfUpgrade gson to 2.8.8 (Closes #6370)0a6103597bGet entity default attributes (#6449)40057019e0Correctly inflate villager activation bounding box (#6798)e5f9241d15Left handed API (#6775)40ee63496cAdd advancement display API (#6175)9d570042edAdd ItemFactory#getMonsterEgg API (#6772)55ca459515rename method to getSpawnEggbb397ba74cAdd critical damage API (#6275)f47aeafe00Add Horse Animation API (#5599)7a0886180fAT & Mapping fixes (#6809)5553432644docs: Update gradle instructions for Java 16 (#6811) [ci skip]a1f49e4c60Fix command suggestion leak (#6592)9472d38f3cFix method name for Critical damage (#6813)
60 lines
3.6 KiB
Diff
60 lines
3.6 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 farmland trampling is fully disabled or 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/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
|
index e06a8a68ccb9c9a77df061264e58fd850cf1f794..010da2b44fa3a4f033e4f86e9a0917b5c94b6ab5 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
|
@@ -114,12 +114,20 @@ public class FarmBlock extends Block {
|
|
}
|
|
|
|
// Purpur start
|
|
+ if (world.purpurConfig.farmlandTramplingDisabled) return;
|
|
+ if (world.purpurConfig.farmlandTramplingOnlyPlayers && !(entity instanceof Player)) return;
|
|
if (world.purpurConfig.farmlandAlpha) {
|
|
Block block = world.getBlockState(pos.below()).getBlock();
|
|
if (block instanceof FenceBlock || block instanceof WallBlock) {
|
|
return;
|
|
}
|
|
}
|
|
+ if (world.purpurConfig.farmlandTramplingFeatherFalling) {
|
|
+ Iterator<net.minecraft.world.item.ItemStack> armor = entity.getArmorSlots().iterator();
|
|
+ if (armor.hasNext() && net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.FALL_PROTECTION, armor.next()) >= (int) entity.fallDistance) {
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
// Purpur end
|
|
if (CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.DIRT.defaultBlockState()).isCancelled()) {
|
|
return;
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 4432330c936e060b1bb5005ebe70cf575249e5d9..7a3b246cd6254b7806b54f4f4d23fd22a2cba8a8 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -480,10 +480,16 @@ public class PurpurWorldConfig {
|
|
public boolean farmlandBypassMobGriefing = false;
|
|
public boolean farmlandGetsMoistFromBelow = false;
|
|
public boolean farmlandAlpha = false;
|
|
+ public boolean farmlandTramplingDisabled = 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);
|
|
+ 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);
|
|
}
|
|
|
|
public boolean furnaceUseLavaFromUnderneath = false;
|