PaperMC/Spigot-Server-Patches/0129-Add-API-methods-to-control-if-armour-stands-can-move.patch

53 lines
2.2 KiB
Diff
Raw Normal View History

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 c2672f55f1da295c97bacc1313f84198573c0187..73e5bd74f6f9b1532d4abf8d8a0383c851daf35f 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
2019-04-27 08:26:04 +02:00
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
2019-04-27 08:26:04 +02:00
+ public void move(EnumMoveType moveType, Vec3D vec3d) {
+ if (this.canMove) {
2019-04-27 08:26:04 +02:00
+ 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 253033878391f6cac97dcdbffe151ca82e830a9c..76176a3de05295a5493e0990116759505029dedc 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().bv & (1 << CraftEquipmentSlot.getNMS(equipmentSlot).c() + lockType.ordinal() * 8)) != 0;
}
+ // Paper start
+ @Override
+ public boolean canMove() {
+ return getHandle().canMove;
+ }
+
+ @Override
+ public void setCanMove(boolean move) {
+ getHandle().canMove = move;
+ }
+ // Paper end
}