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 9fe8dcea8f5075a5420a4355bb3c27c2311d8f94..acf1cb25f75b35e064e7099d85693632073df858 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -413,7 +413,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 @@ -424,7 +425,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 {