3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 13:00:06 +01:00
Paper/Spigot-Server-Patches/0341-Allow-disabling-armour-stand-ticking.patch

73 Zeilen
3.1 KiB
Diff

From bf9011addc8b350feb0b7de1e019e8dbdf8ffabe Mon Sep 17 00:00:00 2001
2018-08-15 10:26:51 +02:00
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 61c8b58b1..458baf444 100644
2018-08-15 10:26:51 +02:00
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -483,4 +483,10 @@ public class PaperWorldConfig {
allowPermaChunkLoaders = getBoolean("game-mechanics.allow-permanent-chunk-loaders", allowPermaChunkLoaders);
log("Allow Perma Chunk Loaders: " + (allowPermaChunkLoaders ? "enabled" : "disabled"));
2018-08-15 10:26:51 +02:00
}
+
+ 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 3b2b94d8c..7edeb9bb0 100644
2018-08-15 10:26:51 +02:00
--- 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 {
2018-08-15 10:26:51 +02:00
public Vector3f leftLegPose;
public Vector3f rightLegPose;
public boolean canMove = true; // Paper
+ public boolean canTick = true; // Paper - armour stand ticking
public EntityArmorStand(World world) {
super(EntityTypes.ARMOR_STAND, world);
@@ -57,6 +58,7 @@ public class EntityArmorStand extends EntityLiving {
this.leftLegPose = EntityArmorStand.bB;
this.rightLegPose = EntityArmorStand.bC;
2018-08-15 10:26:51 +02:00
this.noclip = this.isNoGravity();
+ if (world != null) this.canTick = world.paperConfig.armorStandTick; // Paper - armour stand ticking
this.setSize(0.5F, 1.975F);
this.Q = 0.0F;
2018-08-15 10:26:51 +02:00
}
@@ -554,6 +556,7 @@ public class EntityArmorStand extends EntityLiving {
2018-08-15 10:26:51 +02:00
}
public void tick() {
2018-08-15 10:26:51 +02:00
+ if (!this.canTick) return;// Paper
super.tick();
2018-08-15 10:26:51 +02:00
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 9f5c3b92e..07ce93f17 100644
2018-08-15 10:26:51 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
@@ -297,5 +297,15 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
public boolean isSlotDisabled(org.bukkit.inventory.EquipmentSlot slot) {
return getHandle().isSlotDisabled(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot));
2018-08-15 10:26:51 +02:00
}
+
+ @Override
+ public boolean canTick() {
+ return this.getHandle().canTick;
+ }
+
+ @Override
+ public void setCanTick(final boolean tick) {
+ this.getHandle().canTick = tick;
+ }
// Paper end
2018-08-15 10:26:51 +02:00
}
--
2.18.0