mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Add Entities can use portals patch back (#1571)
This commit is contained in:
@@ -1,59 +0,0 @@
|
||||
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 99798220b6e0ad06db2ba5c9b74bfb72af185fee..12a0c69f8fec30fad64cbb00af2ca1bbf0ea5153 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
@@ -126,12 +126,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 = ((LivingEntity) entity).getArmorSlots().iterator();
|
||||
+ if (armor.hasNext() && net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.FEATHER_FALLING, armor.next()) >= (int) entity.fallDistance) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
// Purpur end
|
||||
if (!CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.DIRT.defaultBlockState())) {
|
||||
return;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index ea8288b00d7a9cf5d1529a13011b7df7aac55a3a..6958742eb8bafab17f79bb29137dde3f9d9ba5e2 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -453,10 +453,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;
|
||||
Reference in New Issue
Block a user