From edb9d18aed46e0e9db831fdac4d58be1d4827841 Mon Sep 17 00:00:00 2001 From: kashike Date: Wed, 15 Aug 2018 01:26:51 -0700 Subject: [PATCH] Allow disabling armour stand ticking --- ...Allow-disabling-armour-stand-ticking.patch | 35 +++++++++ ...Allow-disabling-armour-stand-ticking.patch | 73 +++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 Spigot-API-Patches/0128-Allow-disabling-armour-stand-ticking.patch create mode 100644 Spigot-Server-Patches/0352-Allow-disabling-armour-stand-ticking.patch diff --git a/Spigot-API-Patches/0128-Allow-disabling-armour-stand-ticking.patch b/Spigot-API-Patches/0128-Allow-disabling-armour-stand-ticking.patch new file mode 100644 index 0000000000..71a6b707b7 --- /dev/null +++ b/Spigot-API-Patches/0128-Allow-disabling-armour-stand-ticking.patch @@ -0,0 +1,35 @@ +From 800083976a454caf39f0a2019df51e3af314b022 Mon Sep 17 00:00:00 2001 +From: kashike +Date: Wed, 15 Aug 2018 01:26:03 -0700 +Subject: [PATCH] Allow disabling armour stand ticking + + +diff --git a/src/main/java/org/bukkit/entity/ArmorStand.java b/src/main/java/org/bukkit/entity/ArmorStand.java +index 099da6ce..859f166f 100644 +--- a/src/main/java/org/bukkit/entity/ArmorStand.java ++++ b/src/main/java/org/bukkit/entity/ArmorStand.java +@@ -275,5 +275,21 @@ public interface ArmorStand extends LivingEntity { + * @param move {@code true} if this armour stand can move, {@code false} otherwise + */ + void setCanMove(boolean move); ++ ++ /** ++ * Tests if this armor stand can tick. ++ * ++ *

The default value is defined in {@code paper.yml}.

++ * ++ * @return {@code true} if this armour stand can tick, {@code false} otherwise ++ */ ++ boolean canTick(); ++ ++ /** ++ * Sets if this armor stand can tick. ++ * ++ * @param tick {@code true} if this armour stand can tick, {@code false} otherwise ++ */ ++ void setCanTick(final boolean tick); + // Paper end + } +-- +2.18.0 + diff --git a/Spigot-Server-Patches/0352-Allow-disabling-armour-stand-ticking.patch b/Spigot-Server-Patches/0352-Allow-disabling-armour-stand-ticking.patch new file mode 100644 index 0000000000..8a03395655 --- /dev/null +++ b/Spigot-Server-Patches/0352-Allow-disabling-armour-stand-ticking.patch @@ -0,0 +1,73 @@ +From 8e587147671ae4291c03ddbec1a4687639db87e9 Mon Sep 17 00:00:00 2001 +From: kashike +Date: Wed, 15 Aug 2018 01:26:09 -0700 +Subject: [PATCH] Allow disabling armour stand ticking + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index c3bd82692..ed1475351 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -584,4 +584,10 @@ public class PaperWorldConfig { + break; + } + } ++ ++ public boolean armorStandTick = true; ++ private void armorStandTick() { ++ this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick); ++ log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default"); ++ } + } +diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java +index df0d66ad0..dca497072 100644 +--- a/src/main/java/net/minecraft/server/EntityArmorStand.java ++++ b/src/main/java/net/minecraft/server/EntityArmorStand.java +@@ -51,6 +51,7 @@ public class EntityArmorStand extends EntityLiving { + public Vector3f leftLegPose; + public Vector3f rightLegPose; + public boolean canMove = true; // Paper ++ public boolean canTick = true; // Paper - armour stand ticking + + public EntityArmorStand(World world) { + super(world); +@@ -64,6 +65,7 @@ public class EntityArmorStand extends EntityLiving { + this.rightLegPose = EntityArmorStand.bw; + this.noclip = this.isNoGravity(); + this.setSize(0.5F, 1.975F); ++ if (world != null) this.canTick = world.paperConfig.armorStandTick; // Paper - armour stand ticking + } + + public EntityArmorStand(World world, double d0, double d1, double d2) { +@@ -568,6 +570,7 @@ public class EntityArmorStand extends EntityLiving { + } + + public void B_() { ++ if (!this.canTick) return;// Paper + super.B_(); + Vector3f vector3f = (Vector3f) this.datawatcher.get(EntityArmorStand.b); + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java +index 8a06cb165..91b7bc2ed 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java +@@ -221,4 +221,16 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand { + public void setCanMove(boolean move) { + getHandle().canMove = move; + } ++ ++ // Paper start ++ @Override ++ public boolean canTick() { ++ return this.getHandle().canTick; ++ } ++ ++ @Override ++ public void setCanTick(final boolean tick) { ++ this.getHandle().canTick = tick; ++ } ++ // Paper end + } +-- +2.18.0 +