mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 00:10:32 +01:00
de04cbced5
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: f29cb801 Separate checkstyle-suppressions file is not required 86f99bbe SPIGOT-7540, PR-946: Add ServerTickManager API d4119585 SPIGOT-6903, PR-945: Add BlockData#getMapColor b7a2ed41 SPIGOT-7530, PR-947: Add Player#removeResourcePack 9dd56255 SPIGOT-7527, PR-944: Add WindCharge#explode() 994a6163 Attempt upgrade of resolver libraries CraftBukkit Changes: b3b43a6ad Add Checkstyle check for unused imports 13fb3358e SPIGOT-7544: Scoreboard#getEntries() doesn't get entries but class names 3dda99c06 SPIGOT-7540, PR-1312: Add ServerTickManager API 2ab4508c0 SPIGOT-6903, PR-1311: Add BlockData#getMapColor 1dbdbbed4 PR-1238: Remove unnecessary sign ticking 659728d2a MC-264285, SPIGOT-7439, PR-1237: Fix unbreakable flint and steel is completely consumed while igniting creeper e37e29ce0 Increase outdated build delay c00438b39 SPIGOT-7530, PR-1313: Add Player#removeResourcePack 492dd80ce SPIGOT-7527, PR-1310: Add WindCharge#explode() e11fbb9d7 Upgrade MySQL driver 9f3a0bd2a Attempt upgrade of resolver libraries 60d16d7ca PR-1306: Centralize Bukkit and Minecraft entity conversion Spigot Changes: 06d602e7 Rebuild patches
146 lines
5.8 KiB
Diff
146 lines
5.8 KiB
Diff
From 0000000000000000000000000000000000000000 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/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
|
index aff1b2195d2f187739394886d4c0bdbf0cb306b4..948ba97e318506dad96e59121297b5bf8340d2e6 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
|
@@ -93,9 +93,16 @@ public class ArmorStand extends LivingEntity {
|
|
public Rotations leftLegPose;
|
|
public Rotations rightLegPose;
|
|
public boolean canMove = true; // Paper
|
|
+ // Paper start - Allow ArmorStands not to tick
|
|
+ public boolean canTick = true;
|
|
+ public boolean canTickSetByAPI = false;
|
|
+ private boolean noTickPoseDirty = false;
|
|
+ private boolean noTickEquipmentDirty = false;
|
|
+ // Paper end
|
|
|
|
public ArmorStand(EntityType<? extends ArmorStand> type, Level world) {
|
|
super(type, world);
|
|
+ if (world != null) this.canTick = world.paperConfig().entities.armorStands.tick; // Paper - armour stand ticking
|
|
this.handItems = NonNullList.withSize(2, ItemStack.EMPTY);
|
|
this.armorItems = NonNullList.withSize(4, ItemStack.EMPTY);
|
|
this.headPose = ArmorStand.DEFAULT_HEAD_POSE;
|
|
@@ -190,6 +197,7 @@ public class ArmorStand extends LivingEntity {
|
|
this.onEquipItem(enumitemslot, (ItemStack) this.armorItems.set(enumitemslot.getIndex(), itemstack), itemstack, silent); // CraftBukkit
|
|
}
|
|
|
|
+ this.noTickEquipmentDirty = true; // Paper - Allow equipment to be updated even when tick disabled
|
|
}
|
|
|
|
@Override
|
|
@@ -240,6 +248,7 @@ public class ArmorStand extends LivingEntity {
|
|
}
|
|
|
|
nbt.put("Pose", this.writePose());
|
|
+ if (this.canTickSetByAPI) nbt.putBoolean("Paper.CanTickOverride", this.canTick); // Paper - persist no tick setting
|
|
}
|
|
|
|
@Override
|
|
@@ -271,6 +280,12 @@ public class ArmorStand extends LivingEntity {
|
|
this.setNoBasePlate(nbt.getBoolean("NoBasePlate"));
|
|
this.setMarker(nbt.getBoolean("Marker"));
|
|
this.noPhysics = !this.hasPhysics();
|
|
+ // Paper start - persist no tick
|
|
+ if (nbt.contains("Paper.CanTickOverride")) {
|
|
+ this.canTick = nbt.getBoolean("Paper.CanTickOverride");
|
|
+ this.canTickSetByAPI = true;
|
|
+ }
|
|
+ // Paper end
|
|
CompoundTag nbttagcompound1 = nbt.getCompound("Pose");
|
|
|
|
this.readPose(nbttagcompound1);
|
|
@@ -658,7 +673,29 @@ public class ArmorStand extends LivingEntity {
|
|
|
|
@Override
|
|
public void tick() {
|
|
+ // Paper start
|
|
+ if (!this.canTick) {
|
|
+ if (this.noTickPoseDirty) {
|
|
+ this.noTickPoseDirty = false;
|
|
+ this.updatePose();
|
|
+ }
|
|
+
|
|
+ if (this.noTickEquipmentDirty) {
|
|
+ this.noTickEquipmentDirty = false;
|
|
+ this.detectEquipmentUpdatesPublic();
|
|
+ }
|
|
+
|
|
+ return;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
super.tick();
|
|
+ // Paper start - Split into separate method
|
|
+ updatePose();
|
|
+ }
|
|
+
|
|
+ public void updatePose() {
|
|
+ // Paper end
|
|
Rotations vector3f = (Rotations) this.entityData.get(ArmorStand.DATA_HEAD_POSE);
|
|
|
|
if (!this.headPose.equals(vector3f)) {
|
|
@@ -787,31 +824,37 @@ public class ArmorStand extends LivingEntity {
|
|
public void setHeadPose(Rotations angle) {
|
|
this.headPose = angle;
|
|
this.entityData.set(ArmorStand.DATA_HEAD_POSE, angle);
|
|
+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking
|
|
}
|
|
|
|
public void setBodyPose(Rotations angle) {
|
|
this.bodyPose = angle;
|
|
this.entityData.set(ArmorStand.DATA_BODY_POSE, angle);
|
|
+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking
|
|
}
|
|
|
|
public void setLeftArmPose(Rotations angle) {
|
|
this.leftArmPose = angle;
|
|
this.entityData.set(ArmorStand.DATA_LEFT_ARM_POSE, angle);
|
|
+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking
|
|
}
|
|
|
|
public void setRightArmPose(Rotations angle) {
|
|
this.rightArmPose = angle;
|
|
this.entityData.set(ArmorStand.DATA_RIGHT_ARM_POSE, angle);
|
|
+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking
|
|
}
|
|
|
|
public void setLeftLegPose(Rotations angle) {
|
|
this.leftLegPose = angle;
|
|
this.entityData.set(ArmorStand.DATA_LEFT_LEG_POSE, angle);
|
|
+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking
|
|
}
|
|
|
|
public void setRightLegPose(Rotations angle) {
|
|
this.rightLegPose = angle;
|
|
this.entityData.set(ArmorStand.DATA_RIGHT_LEG_POSE, angle);
|
|
+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking
|
|
}
|
|
|
|
public Rotations getHeadPose() {
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
|
|
index 52ffc401bbb9fa768534a4b871f9cc7dbebb8b20..9923cea74ba39a774d6b16a225bc3e455e54c418 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
|
|
@@ -232,5 +232,16 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
|
|
public void setCanMove(boolean move) {
|
|
getHandle().canMove = move;
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public boolean canTick() {
|
|
+ return this.getHandle().canTick;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setCanTick(final boolean tick) {
|
|
+ this.getHandle().canTick = tick;
|
|
+ this.getHandle().canTickSetByAPI = true;
|
|
+ }
|
|
// Paper end
|
|
}
|