mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
89 lines
5.0 KiB
Diff
89 lines
5.0 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/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
|
index c0e8739f0dd9290550872839eddca4b0090b603b..cfe26c762b2affa5050c175f6ab0306af6cfbe71 100644
|
|
--- a/net/minecraft/world/entity/Entity.java
|
|
+++ b/net/minecraft/world/entity/Entity.java
|
|
@@ -2037,7 +2037,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
return this.isInWater() || flag;
|
|
}
|
|
|
|
- void updateInWaterStateAndDoWaterCurrentPushing() {
|
|
+ public void updateInWaterStateAndDoWaterCurrentPushing() { // Purpur - package-private -> public - Movement options for armor stands
|
|
Entity entity = this.getVehicle();
|
|
|
|
if (entity instanceof AbstractBoat abstractboat) {
|
|
diff --git a/net/minecraft/world/entity/decoration/ArmorStand.java b/net/minecraft/world/entity/decoration/ArmorStand.java
|
|
index 12ff824ffa81ea45f76337ec2b6d80b01047b698..e1c7a644dc922ca726cebf71ec2f0b159d6db289 100644
|
|
--- a/net/minecraft/world/entity/decoration/ArmorStand.java
|
|
+++ b/net/minecraft/world/entity/decoration/ArmorStand.java
|
|
@@ -114,10 +114,12 @@ public class ArmorStand extends LivingEntity {
|
|
private boolean noTickPoseDirty = false;
|
|
private boolean noTickEquipmentDirty = false;
|
|
// Paper end - Allow ArmorStands not to tick
|
|
+ public boolean canMovementTick = true; // Purpur - Movement options for armor stands
|
|
|
|
public ArmorStand(EntityType<? extends ArmorStand> type, Level world) {
|
|
super(type, world);
|
|
if (world != null) this.canTick = world.paperConfig().entities.armorStands.tick; // Paper - Allow ArmorStands not to tick
|
|
+ if (world != null) this.canMovementTick = world.purpurConfig.armorstandMovement; // Purpur - Movement options for armor stands
|
|
this.handItems = NonNullList.withSize(2, ItemStack.EMPTY);
|
|
this.armorItems = NonNullList.withSize(4, ItemStack.EMPTY);
|
|
this.headPose = ArmorStand.DEFAULT_HEAD_POSE;
|
|
@@ -1015,4 +1017,18 @@ public class ArmorStand extends LivingEntity {
|
|
}
|
|
}
|
|
// Paper end
|
|
+
|
|
+ // Purpur start - Movement options for armor stands
|
|
+ @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 - Movement options for armor stands
|
|
}
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index 3739561c633627ba3fe80f89bce84a243705f4bc..86b27b11f178be0cc05842ccb3ffe4ef14196855 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -100,10 +100,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;
|