Add option to set armorstand step height

This commit is contained in:
William Blake Galbreath
2025-01-05 14:17:27 -08:00
committed by granny
parent 4945212daf
commit e4247eb565
5 changed files with 36 additions and 59 deletions

View File

@@ -1,55 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
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;

View File

@@ -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

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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;