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

Paper Changes:
PaperMC/Paper@b097a24 Expose isUnderWater to Entity (#8454)
PaperMC/Paper@6b26cfc Add missing Entity + Projectile API (#7632)
PaperMC/Paper@de2d2d4 Add PlayerInventorySlotChangeEvent (#7321)
PaperMC/Paper@f7c8d79 Fix stacktrace in server tests
PaperMC/Paper@b9cf1ac Fix a classloading issue in tests (#8459)
PaperMC/Paper@7fe34e9 Make CraftMinecartTNT public
PaperMC/Paper@514a606 Elder Guardian appearance API (#8455)
PaperMC/Paper@2094011 Update settings directory path in exceptions (#7968)
PaperMC/Paper@0bdf997 Avoid cycle deprecation (#8466)
PaperMC/Paper@eb68bd4 Allow changing bed's 'occupied' property (#8458)
2022-10-15 12:51:22 -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 8e5087ca2df8ca26f3cbfeacdb33d846628ca658..9276b51813e1e0ac6cf8cf9a295d92db2f52b11e 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1732,7 +1732,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 0c4b76cd3b6248df99d31d28c7521a0fe6aea89e..6800d77262c244e5bb32535d920b025b279dd8e2 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;
@@ -995,4 +997,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 efdb38bb6cb70176460514cb63e5bf5c984f7911..97143ad57276e7f62b50578096972c7581a6158b 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -102,10 +102,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 arrowMovementResetsDespawnCounter = true;