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 59f6f8474f77f0cb332072dfe0b4d47464c1b78a..6808c73049ebe108c8229b3d2d92d9aeb246e3e5 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -401,7 +401,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 @@ -412,7 +413,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 459cba838468b95547b2a515c497fcbb7bd45718..b1293935e55fcb1c45224e5bda9be8d1045ff4e8 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 {