From e4247eb56577ed316f111f993d35125a038f3920 Mon Sep 17 00:00:00 2001 From: William Blake Galbreath Date: Sun, 5 Jan 2025 14:17:27 -0800 Subject: [PATCH] Add option to set armorstand step height --- ...option-to-set-armorstand-step-height.patch | 55 ------------------- .../features/0001-Ridables.patch | 8 +-- .../minecraft/world/entity/Entity.java.patch | 17 ++++++ .../entity/decoration/ArmorStand.java.patch | 10 ++++ .../purpurmc/purpur/PurpurWorldConfig.java | 5 ++ 5 files changed, 36 insertions(+), 59 deletions(-) delete mode 100644 patches/server/0031-Add-option-to-set-armorstand-step-height.patch create mode 100644 purpur-server/minecraft-patches/sources/net/minecraft/world/entity/decoration/ArmorStand.java.patch diff --git a/patches/server/0031-Add-option-to-set-armorstand-step-height.patch b/patches/server/0031-Add-option-to-set-armorstand-step-height.patch deleted file mode 100644 index 6b19991b2..000000000 --- a/patches/server/0031-Add-option-to-set-armorstand-step-height.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Sun, 6 Oct 2019 12:46:35 -0500 -Subject: [PATCH] Add option to set armorstand step height - - -diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 755861185bd8434027acca7f03ed0bfdf9fa2cde..fe5e8009d16fe9292312e37538b02b92b9fea9ed 100644 ---- a/net/minecraft/world/entity/Entity.java -+++ b/net/minecraft/world/entity/Entity.java -@@ -300,6 +300,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - public double xOld; - public double yOld; - public double zOld; -+ public float maxUpStep; // Purpur - public boolean noPhysics; - private boolean wasOnFire; - public final RandomSource random; -@@ -5169,7 +5170,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - } - - public float maxUpStep() { -- return 0.0F; -+ return maxUpStep; - } - - public void onExplosionHit(@Nullable Entity entity) {} -diff --git a/net/minecraft/world/entity/decoration/ArmorStand.java b/net/minecraft/world/entity/decoration/ArmorStand.java -index 70b8023c3badc745f342d5b0ab54699e3923826a..edb0cd90e28016c44b0aaf5c9ed5d7bdbced5295 100644 ---- a/net/minecraft/world/entity/decoration/ArmorStand.java -+++ b/net/minecraft/world/entity/decoration/ArmorStand.java -@@ -681,6 +681,7 @@ public class ArmorStand extends LivingEntity { - - @Override - public void tick() { -+ maxUpStep = level().purpurConfig.armorstandStepHeight; - // Paper start - Allow ArmorStands not to tick - if (!this.canTick) { - if (this.noTickPoseDirty) { -diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index dcc8e4880c1bfff1abdc1b542000d61e3378d4f1..149360f01139fa4b14e27e5b34fe3fe7682c7ffc 100644 ---- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -@@ -91,6 +91,11 @@ public class PurpurWorldConfig { - return value.isEmpty() ? fallback : value; - } - -+ public float armorstandStepHeight = 0.0F; -+ private void armorstandSettings() { -+ armorstandStepHeight = (float) getDouble("gameplay-mechanics.armorstand.step-height", armorstandStepHeight); -+ } -+ - public boolean idleTimeoutKick = true; - public boolean idleTimeoutTickNearbyEntities = true; - public boolean idleTimeoutCountAsSleeping = false; diff --git a/purpur-server/minecraft-patches/features/0001-Ridables.patch b/purpur-server/minecraft-patches/features/0001-Ridables.patch index c697e3aef..c52339c2f 100644 --- a/purpur-server/minecraft-patches/features/0001-Ridables.patch +++ b/purpur-server/minecraft-patches/features/0001-Ridables.patch @@ -75,10 +75,10 @@ index b083228bb3dc87794c6f177ad99832daf6925a39..bf863cfae63a50636c3fcc8fcf9761f1 if ((target instanceof Bucketable && target instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) { target.resendPossiblyDesyncedEntityData(ServerGamePacketListenerImpl.this.player); // Paper - The entire mob gets deleted, so resend it diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 717540737a98ff54e61f0c3e15174d2f77ffe553..52465a528ad0bf0509b128e40779bbef843648a6 100644 +index 4575ea1d17bf22790d742a9d73aa88ded665809d..7797dd4d87ea29585d93461126a0d781ed7daec5 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -3128,6 +3128,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3129,6 +3129,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.passengers = ImmutableList.copyOf(list); } @@ -92,7 +92,7 @@ index 717540737a98ff54e61f0c3e15174d2f77ffe553..52465a528ad0bf0509b128e40779bbef this.gameEvent(GameEvent.ENTITY_MOUNT, passenger); } } -@@ -3169,6 +3176,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3170,6 +3177,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return false; } // CraftBukkit end @@ -107,7 +107,7 @@ index 717540737a98ff54e61f0c3e15174d2f77ffe553..52465a528ad0bf0509b128e40779bbef if (this.passengers.size() == 1 && this.passengers.get(0) == passenger) { this.passengers = ImmutableList.of(); } else { -@@ -5083,4 +5098,44 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -5084,4 +5099,44 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return ((ServerLevel) this.level).isPositionEntityTicking(this.blockPosition()); } // Paper end - Expose entity id counter diff --git a/purpur-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch b/purpur-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch index f2101ff06..bf96394f0 100644 --- a/purpur-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch +++ b/purpur-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch @@ -9,3 +9,20 @@ // CraftBukkit start private static final int CURRENT_LEVEL = 2; public boolean preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported; keep initial motion on first setPositionRotation +@@ -253,6 +_,7 @@ + public double xOld; + public double yOld; + public double zOld; ++ public float maxUpStep; // Purpur - Add option to set armorstand step height + public boolean noPhysics; + private boolean wasOnFire; + public final RandomSource random = SHARED_RANDOM; // Paper - Share random for entities to make them more random +@@ -4885,7 +_,7 @@ + } + + public float maxUpStep() { +- return 0.0F; ++ return maxUpStep; // Purpur - Add option to set armorstand step height + } + + public void onExplosionHit(@Nullable Entity entity) { diff --git a/purpur-server/minecraft-patches/sources/net/minecraft/world/entity/decoration/ArmorStand.java.patch b/purpur-server/minecraft-patches/sources/net/minecraft/world/entity/decoration/ArmorStand.java.patch new file mode 100644 index 000000000..9b368ab1b --- /dev/null +++ b/purpur-server/minecraft-patches/sources/net/minecraft/world/entity/decoration/ArmorStand.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/world/entity/decoration/ArmorStand.java ++++ b/net/minecraft/world/entity/decoration/ArmorStand.java +@@ -620,6 +_,7 @@ + + @Override + public void tick() { ++ maxUpStep = level().purpurConfig.armorstandStepHeight; // Purpur - Add option to set armorstand step height + // Paper start - Allow ArmorStands not to tick + if (!this.canTick) { + if (this.noTickPoseDirty) { diff --git a/purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java index 90e4ba05f..6ebcd5f75 100644 --- a/purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -77,6 +77,11 @@ public class PurpurWorldConfig { return value.isEmpty() ? fallback : value; } + public float armorstandStepHeight = 0.0F; + private void armorstandSettings() { + armorstandStepHeight = (float) getDouble("gameplay-mechanics.armorstand.step-height", armorstandStepHeight); + } + public boolean idleTimeoutKick = true; public boolean idleTimeoutTickNearbyEntities = true; public boolean idleTimeoutCountAsSleeping = false;