From c8fb4667af7303b82dd6c355dc5624c9a641d89c Mon Sep 17 00:00:00 2001 From: kashike Date: Wed, 21 Dec 2016 11:53:41 -0600 Subject: [PATCH] API for ArmorStand movement and option for entity lookups --- ...to-control-if-armour-stands-can-move.patch | 36 +++++++++++++ ...to-control-if-armour-stands-can-move.patch | 54 +++++++++++++++++++ ...t-armor-stands-from-doing-entity-loo.patch | 35 ++++++++++++ 3 files changed, 125 insertions(+) create mode 100644 Spigot-API-Patches/0045-Add-API-methods-to-control-if-armour-stands-can-move.patch create mode 100644 Spigot-Server-Patches/0189-Add-API-methods-to-control-if-armour-stands-can-move.patch create mode 100644 Spigot-Server-Patches/0190-Option-to-prevent-armor-stands-from-doing-entity-loo.patch diff --git a/Spigot-API-Patches/0045-Add-API-methods-to-control-if-armour-stands-can-move.patch b/Spigot-API-Patches/0045-Add-API-methods-to-control-if-armour-stands-can-move.patch new file mode 100644 index 0000000000..b314b1411c --- /dev/null +++ b/Spigot-API-Patches/0045-Add-API-methods-to-control-if-armour-stands-can-move.patch @@ -0,0 +1,36 @@ +From 7226ac4a27ddff4001102f91265fbd8e0cb1e722 Mon Sep 17 00:00:00 2001 +From: kashike +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/org/bukkit/entity/ArmorStand.java b/src/main/java/org/bukkit/entity/ArmorStand.java +index b4f0451..099da6c 100644 +--- a/src/main/java/org/bukkit/entity/ArmorStand.java ++++ b/src/main/java/org/bukkit/entity/ArmorStand.java +@@ -258,4 +258,22 @@ public interface ArmorStand extends LivingEntity { + * @param marker whether this is a marker + */ + void setMarker(boolean marker); ++ ++ // Paper start ++ /** ++ * Tests if this armor stand can move. ++ * ++ *

The default value is {@code true}.

++ * ++ * @return {@code true} if this armour stand can move, {@code false} otherwise ++ */ ++ boolean canMove(); ++ ++ /** ++ * Sets if this armor stand can move. ++ * ++ * @param move {@code true} if this armour stand can move, {@code false} otherwise ++ */ ++ void setCanMove(boolean move); ++ // Paper end + } +-- +2.9.3 + diff --git a/Spigot-Server-Patches/0189-Add-API-methods-to-control-if-armour-stands-can-move.patch b/Spigot-Server-Patches/0189-Add-API-methods-to-control-if-armour-stands-can-move.patch new file mode 100644 index 0000000000..2ac18045f3 --- /dev/null +++ b/Spigot-Server-Patches/0189-Add-API-methods-to-control-if-armour-stands-can-move.patch @@ -0,0 +1,54 @@ +From f1ec82f7d05366e3b71f50a52b3886376e0fed60 Mon Sep 17 00:00:00 2001 +From: kashike +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 96bb110..7738ca3 100644 +--- a/src/main/java/net/minecraft/server/EntityArmorStand.java ++++ b/src/main/java/net/minecraft/server/EntityArmorStand.java +@@ -50,6 +50,7 @@ public class EntityArmorStand extends EntityLiving { + public Vector3f rightArmPose; + public Vector3f leftLegPose; + public Vector3f rightLegPose; ++ public boolean canMove = true; // Paper + + public EntityArmorStand(World world) { + super(world); +@@ -763,4 +764,13 @@ public class EntityArmorStand extends EntityLiving { + public boolean cK() { + return false; + } ++ ++ // Paper start ++ @Override ++ public void move(EnumMoveType moveType, double x, double y, double z) { ++ if (this.canMove) { ++ super.move(moveType, x, y, z); ++ } ++ } ++ // 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 2b66a08..8a06cb1 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java +@@ -211,4 +211,14 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand { + public void setMarker(boolean marker) { + getHandle().setMarker(marker); + } ++ ++ @Override ++ public boolean canMove() { ++ return getHandle().canMove; ++ } ++ ++ @Override ++ public void setCanMove(boolean move) { ++ getHandle().canMove = move; ++ } + } +-- +2.9.3 + diff --git a/Spigot-Server-Patches/0190-Option-to-prevent-armor-stands-from-doing-entity-loo.patch b/Spigot-Server-Patches/0190-Option-to-prevent-armor-stands-from-doing-entity-loo.patch new file mode 100644 index 0000000000..4a50b9b198 --- /dev/null +++ b/Spigot-Server-Patches/0190-Option-to-prevent-armor-stands-from-doing-entity-loo.patch @@ -0,0 +1,35 @@ +From b5fc17d23094f1c25d9bae76e0bff778afea011e Mon Sep 17 00:00:00 2001 +From: kashike +Date: Wed, 21 Dec 2016 11:52:04 -0600 +Subject: [PATCH] Option to prevent armor stands from doing entity lookups + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index a655b33..e8762c4 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -409,4 +409,9 @@ public class PaperWorldConfig { + log("Treasure Maps will return already discovered locations"); + } + } ++ ++ public boolean armorStandEntityLookups = true; ++ private void armorStandEntityLookups() { ++ armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true); ++ } + } +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index 2911c65..6d548dd 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -1332,6 +1332,7 @@ public abstract class World implements IBlockAccess { + + this.a(entity, axisalignedbb, false, arraylist); + if (entity != null) { ++ if (entity instanceof EntityArmorStand && !entity.world.paperConfig.armorStandEntityLookups) return arraylist; // Paper + List list = this.getEntities(entity, axisalignedbb.g(0.25D)); + + for (int i = 0; i < list.size(); ++i) { +-- +2.9.3 +