aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0129-Add-API-methods-to-control-if-armour-stands-can-move.patch
blob: 6b9000b82388a670c0de3de99a0210697c2de30c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
index 0631cd531647239858b2a7298f58cc770720f69a..6ee5e1b0bb34ba490a130fbcbdb7a2706c5ecf86 100644
--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java
+++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
@@ -38,6 +38,7 @@ import net.minecraft.world.entity.ai.control.ControllerLook;
 import net.minecraft.world.entity.ai.control.ControllerMove;
 import net.minecraft.world.entity.ai.control.EntityAIBodyControl;
 import net.minecraft.world.entity.ai.goal.PathfinderGoal;
+import net.minecraft.world.entity.ai.goal.PathfinderGoalFloat;
 import net.minecraft.world.entity.ai.goal.PathfinderGoalSelector;
 import net.minecraft.world.entity.ai.navigation.Navigation;
 import net.minecraft.world.entity.ai.navigation.NavigationAbstract;
@@ -45,6 +46,8 @@ import net.minecraft.world.entity.ai.sensing.EntitySenses;
 import net.minecraft.world.entity.decoration.EntityHanging;
 import net.minecraft.world.entity.decoration.EntityLeash;
 import net.minecraft.world.entity.item.EntityItem;
+import net.minecraft.world.entity.monster.EntityBlaze;
+import net.minecraft.world.entity.monster.EntityEnderman;
 import net.minecraft.world.entity.monster.IMonster;
 import net.minecraft.world.entity.player.EntityHuman;
 import net.minecraft.world.entity.vehicle.EntityBoat;
diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
index 72e53968c5fb03301ddec7a0cf937ac2f8cf0901..2ef991aa7f739d3577fbbf4386064557e8f7c904 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
@@ -28,6 +28,7 @@ import net.minecraft.world.entity.EntitySize;
 import net.minecraft.world.entity.EntityTypes;
 import net.minecraft.world.entity.EnumItemSlot;
 import net.minecraft.world.entity.EnumMainHand;
+import net.minecraft.world.entity.EnumMoveType;
 import net.minecraft.world.entity.player.EntityHuman;
 import net.minecraft.world.entity.projectile.EntityArrow;
 import net.minecraft.world.entity.vehicle.EntityMinecartAbstract;
@@ -79,6 +80,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);
@@ -862,4 +864,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 86c8662b3864b264e26f8c63474fdd39bd6c873c..6f922e4cbb095439fcd76ee0d0c08bc4160b8107 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
@@ -229,4 +229,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
 }