Files
Purpur/patches/server/0136-Movement-options-for-armor-stands.patch
BillyGalbreath def1bd407d Updated Upstream (Paper & Pufferfish)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@0c1643c Fix MC-252439 (#7994)
PaperMC/Paper@0ae78d3 Fix advancement saving before reloads (#8003)
PaperMC/Paper@f428887 Prevent empty items from being added to world (#7998)
PaperMC/Paper@dd61319 Couple fixes for command blocks (#8004)
PaperMC/Paper@d1b1c6f Add missing deprecation to AdvancementDisplayType (#7876)
PaperMC/Paper@81f2eec [ci skip] rebuild patches
PaperMC/Paper@e269a0a Fix incorrect random nextLong to nextInt (#8009)
PaperMC/Paper@b77fe3a Temp: Disable javadoc.io for now
PaperMC/Paper@7688112 [ci skip] restore jd.io
PaperMC/Paper@b0eb4e0 Fix number parsing (#8013)

Pufferfish Changes:
pufferfish-gg/Pufferfish@fdfb106 Fix version checker
pufferfish-gg/Pufferfish@b4104a6 Updated Upstream (Paper)
2022-06-18 13:19:30 -05:00

89 lines
4.9 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 armor 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/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 6141ff524ac4fc1ee6bcb2b871be8c0d4b078997..02ac813cfa9bafd931a1fb2f31a0a3cd955cd5d7 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1722,7 +1722,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return this.isInWater() || flag;
}
- void updateInWaterStateAndDoWaterCurrentPushing() {
+ public void updateInWaterStateAndDoWaterCurrentPushing() { // Purpur - package-private -> public
if (this.getVehicle() instanceof Boat) {
this.wasTouchingWater = false;
} else if (this.updateFluidHeightAndDoFluidPushing(FluidTags.WATER, 0.014D)) {
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index 9dcb46959c723723a369cde50427cbee0349f5a1..6bd31ed84049bc36a060b5e01b0599bf5f47765c 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -98,10 +98,12 @@ public class ArmorStand extends LivingEntity {
private boolean noTickPoseDirty = false;
private boolean noTickEquipmentDirty = false;
// Paper end
+ public boolean canMovementTick = true; // Purpur
public ArmorStand(EntityType<? extends ArmorStand> type, Level world) {
super(type, world);
if (world != null) this.canTick = world.paperConfig().entities.armorStands.tick; // Paper - armour stand ticking
+ if (world != null) this.canMovementTick = world.purpurConfig.armorstandMovement; // Purpur
this.handItems = NonNullList.withSize(2, ItemStack.EMPTY);
this.armorItems = NonNullList.withSize(4, ItemStack.EMPTY);
this.headPose = ArmorStand.DEFAULT_HEAD_POSE;
@@ -994,4 +996,18 @@ public class ArmorStand extends LivingEntity {
}
// Paper end
// Paper end
+
+ // Purpur start
+ @Override
+ public void updateInWaterStateAndDoWaterCurrentPushing() {
+ if (this.level.purpurConfig.armorstandWaterMovement &&
+ (this.level.purpurConfig.armorstandWaterFence || !(level.getBlockState(blockPosition().below()).getBlock() instanceof net.minecraft.world.level.block.FenceBlock)))
+ super.updateInWaterStateAndDoWaterCurrentPushing();
+ }
+
+ @Override
+ public void aiStep() {
+ if (this.canMovementTick && this.canMove) super.aiStep();
+ }
+ // Purpur end
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index b4da08402c7b7152cae2d1e1df9a5f35cf1c490f..804a90cfb82d194de5b0f985e04a1fa7f89c29b0 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -101,10 +101,16 @@ public class PurpurWorldConfig {
public float armorstandStepHeight = 0.0F;
public boolean armorstandSetNameVisible = false;
public boolean armorstandFixNametags = false;
+ public boolean armorstandMovement = true;
+ public boolean armorstandWaterMovement = true;
+ public boolean armorstandWaterFence = true;
private void armorstandSettings() {
armorstandStepHeight = (float) getDouble("gameplay-mechanics.armorstand.step-height", armorstandStepHeight);
armorstandSetNameVisible = getBoolean("gameplay-mechanics.armorstand.set-name-visible-when-placing-with-custom-name", armorstandSetNameVisible);
armorstandFixNametags = getBoolean("gameplay-mechanics.armorstand.fix-nametags", armorstandFixNametags);
+ 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 useBetterMending = false;