From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: AlphaKR93 Date: Mon, 4 Dec 2023 23:15:43 +0900 Subject: [PATCH] Suppress errors from dirty attributes diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java index 6f19b5b67c99becbc1cb720274d41d15c7723c31..4ef3d8541c93567e3a9b712c0d4dd5f6cfeb2990 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -415,7 +415,8 @@ public class ServerEntity { } if (this.entity instanceof LivingEntity) { - Set set = ((LivingEntity) this.entity).getAttributes().getDirtyAttributes(); + Set attributes = ((LivingEntity) this.entity).getAttributes().getDirtyAttributes(); // Plazma - Suppress errors from dirty attributes + final Set set = this.level.plazmaConfig().entity.suppressErrorsFromDirtyAttributes ? Collections.synchronizedSet(attributes) : attributes; // Plazma - Suppress errors from dirty attributes if (!set.isEmpty()) { // CraftBukkit start - Send scaled max health @@ -426,7 +427,7 @@ public class ServerEntity { this.broadcastAndSend(new ClientboundUpdateAttributesPacket(this.entity.getId(), set)); } - set.clear(); + attributes.clear(); // Plazma - Suppress errors from dirty attributes } } diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java index bc35244533621436e3c0fb871edf7834ad937f81..a9c8a5918184a2ea364261e279edf7169ae270c7 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java @@ -31,6 +31,7 @@ public class WorldConfigurations extends ConfigurationPart { public boolean ignoreUselessPackets = OPTIMIZE; public int sensorTick = 1; + public boolean suppressErrorsFromDirtyAttributes = OPTIMIZE; public Phantom phantom; public class Phantom extends ConfigurationPart {