3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00
Paper/Spigot-Server-Patches/0351-Allow-disabling-armour-stand-ticking.patch

93 Zeilen
3.6 KiB
Diff

From 6b1beefbc59949532cb4e66f634583d3fadc42a7 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
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 c3bd8269..ed147535 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 df0d66ad..c7215888 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) {
@@ -211,6 +213,7 @@ public class EntityArmorStand extends EntityLiving {
}
nbttagcompound.set("Pose", this.C());
+ nbttagcompound.setBoolean("Paper.CanTick", this.canTick); // Paper - persist no tick setting
}
public void a(NBTTagCompound nbttagcompound) {
@@ -242,6 +245,10 @@ public class EntityArmorStand extends EntityLiving {
this.setMarker(nbttagcompound.getBoolean("Marker"));
this.bC = !this.isMarker();
this.noclip = this.isNoGravity();
+ // Paper - persist no tick
+ if (nbttagcompound.hasKey("Paper.CanTick")) {
+ this.canTick = nbttagcompound.getBoolean("Paper.CanTick");
+ }
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Pose");
this.g(nbttagcompound1);
@@ -568,6 +575,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 8a06cb16..91b7bc2e 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.19.1