Files
Purpur/patches/server/0170-Movement-options-for-armour-stands.patch
jmp 7f4c8f8715 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
7232d8f2a EntityLoadCrossbowEvent#shouldConsumeItem
4740bd6c8 Mark PlayerInventory#getItem as nullable
bd9ace578 Add a config option to limit the number of entities of each type to load/save in a chunk (#4792)
6bafeb5a9 Move logic from last patch into correct place
9668118fd disable entity ticking flag after watchdog obliteration
2021-01-14 14:47:12 -08:00

89 lines
4.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mariell Hoversholm <proximyst@proximyst.com>
Date: Sat, 9 Jan 2021 22:22:59 +0100
Subject: [PATCH] Movement options for armour stands
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 1f73c9c919e5861b76955168691dc6bc0669ce9a..d92b8afe9d6471b66069527e8bd9a6ec370605ae 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1369,7 +1369,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return this.isInWater() || flag;
}
- void aL() {
+ void aL() { // Purpur - diff on change; this is `updateInWaterStateAndDoWaterCurrentPushing()V`
if (this.getVehicle() instanceof EntityBoat) {
this.inWater = false;
} else if (this.a((Tag) TagsFluid.WATER, 0.014D)) {
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
index 6efe59e0385e144c59804e9e5e18e6910b1f6667..951e899e85c622d06bab7c4695366b8305d5b636 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -52,10 +52,12 @@ public class EntityArmorStand extends EntityLiving {
private boolean noTickPoseDirty = false;
private boolean noTickEquipmentDirty = false;
// Paper end
+ public boolean canMovementTick = true; // Purpur
public EntityArmorStand(EntityTypes<? extends EntityArmorStand> entitytypes, World world) {
super(entitytypes, world);
if (world != null) this.canTick = world.paperConfig.armorStandTick; // Paper - armour stand ticking
+ if (world != null) this.canMovementTick = world.purpurConfig.armorstandMovement; // Purpur
this.handItems = NonNullList.a(2, ItemStack.b);
this.armorItems = NonNullList.a(4, ItemStack.b);
this.headPose = EntityArmorStand.bj;
@@ -897,4 +899,18 @@ public class EntityArmorStand extends EntityLiving {
return true;
}
// Paper end
+
+ // Purpur start
+ @Override
+ void aL() {
+ if (this.world.purpurConfig.armorstandWaterMovement &&
+ (this.world.purpurConfig.armorstandWaterFence || !(world.getType(getBlockLocation().down()).getBlock() instanceof BlockFence)))
+ super.aL();
+ }
+
+ @Override
+ public void movementTick() {
+ if (this.canMovementTick && this.canMove) super.movementTick();
+ }
+ // Purpur end
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 0fce0eb902393e28b18b06bea09558f7b5793e0a..242fa7d0acca116f5efcc64066c66b8dca12bce4 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -111,10 +111,16 @@ public class PurpurWorldConfig {
public boolean armorstandSetNameVisible = false;
public boolean armorstandFixNametags = false;
public float armorstandStepHeight = 0.0F;
+ public boolean armorstandMovement = true;
+ public boolean armorstandWaterMovement = true;
+ public boolean armorstandWaterFence = true;
private void armorstandSettings() {
armorstandSetNameVisible = getBoolean("gameplay-mechanics.armorstand.set-name-visible-when-placing-with-custom-name", armorstandSetNameVisible);
armorstandFixNametags = getBoolean("gameplay-mechanics.armorstand.fix-nametags", armorstandFixNametags);
armorstandStepHeight = (float) getDouble("gameplay-mechanics.armorstand.step-height", armorstandStepHeight);
+ armorstandMovement = getBoolean("gameplay-mechanics.armorstand.can-movement-tick", armorstandMovement);
+ armorstandWaterMovement = getBoolean("gameplay-mechanics.armorstand.can-move-in-water", armorstandWaterMovement);
+ armorstandWaterFence = getBoolean("gameplay-mechanics.armorstand.can-move-in-water-over-fence", armorstandWaterFence);
}
public boolean controllableMinecarts = false;