Paper/Spigot-Server-Patches/0129-Add-API-methods-to-control-if-armour-stands-can-move.patch
Aikar 64ed429884
(FIRST 1.16.3): Update Paper to 1.16.3
This is a pretty tiny update with very little changed. Recommended to update
from 1.16.2 ASAP as 1.16.2 is now no longer supported.

Plugins should mostly remain working as the NMS revision did not change.
2020-09-10 19:47:58 -04:00

53 lines
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Wed, 21 Dec 2016 11:47:25 -0600
Subject: [PATCH] Add API methods to control if armour stands can move
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
index ce9614e642d4e5e8cbea67a39061f99545fff942..254c7ad539edfbbd34464b80b523fa2134939ef9 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -45,6 +45,7 @@ public class EntityArmorStand extends EntityLiving {
public Vector3f rightArmPose;
public Vector3f leftLegPose;
public Vector3f rightLegPose;
+ public boolean canMove = true; // Paper
public EntityArmorStand(EntityTypes<? extends EntityArmorStand> entitytypes, World world) {
super(entitytypes, world);
@@ -821,4 +822,13 @@ public class EntityArmorStand extends EntityLiving {
private EntitySize s(boolean flag) {
return flag ? EntityArmorStand.bp : (this.isBaby() ? EntityArmorStand.bq : this.getEntityType().l());
}
+
+ // Paper start
+ @Override
+ public void move(EnumMoveType moveType, Vec3D vec3d) {
+ if (this.canMove) {
+ super.move(moveType, vec3d);
+ }
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
index 7d07f95e669a9da9f2d6f663a75c907e6c829a98..bf2749fd724ac7b67fc0d5887aa307745c5f1835 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
@@ -228,4 +228,15 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
public boolean hasEquipmentLock(EquipmentSlot equipmentSlot, LockType lockType) {
return (getHandle().disabledSlots & (1 << CraftEquipmentSlot.getNMS(equipmentSlot).getSlotFlag() + lockType.ordinal() * 8)) != 0;
}
+ // Paper start
+ @Override
+ public boolean canMove() {
+ return getHandle().canMove;
+ }
+
+ @Override
+ public void setCanMove(boolean move) {
+ getHandle().canMove = move;
+ }
+ // Paper end
}