Update patches to latest 1.21.4 #1

Merged
Chaoscaot merged 242 commits from update/1.21.4 into main 2025-04-23 22:27:11 +02:00
Showing only changes of commit 20df25d3a5 - Show all commits

View File

@@ -2827,14 +2827,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void updateScaledHealth(boolean sendHealth) {
AttributeMap attributemapserver = this.getHandle().getAttributes();
Collection<AttributeInstance> set = attributemapserver.getSyncableAttributes();
this.injectScaledMaxHealth(set, true);
// SPIGOT-3813: Attributes before health
if (this.getHandle().connection != null) {
this.getHandle().connection.send(new ClientboundUpdateAttributesPacket(this.getHandle().getId(), set));
this.getHandle().connection.send(new ClientboundUpdateAttributesPacket(this.getHandle().getId(), Set.of(this.getScaledMaxHealth())));
if (sendHealth) {
this.sendHealthUpdate();
}
@@ -2874,8 +2869,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
break;
}
}
collection.add(getScaledMaxHealth());
}
public AttributeInstance getScaledMaxHealth() {
AttributeInstance dummy = new AttributeInstance(Attributes.MAX_HEALTH, (attribute) -> { });
// Spigot start
double healthMod = this.scaledHealth ? this.healthScale : this.getMaxHealth();
if ( healthMod >= Float.MAX_VALUE || healthMod <= 0 )
{
@@ -2883,8 +2881,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getServer().getLogger().warning( this.getName() + " tried to crash the server with a large health attribute" );
}
dummy.setBaseValue(healthMod);
// Spigot end
collection.add(dummy);
return dummy;
}
@Override