Files
PlazmaBukkitMC/patches/server/0037-Suppress-Error-From-DirtyAttributes.patch
IPECTER 8348420bb7 HotFix - CustomRecipe
Add - Bump Dependencies
2023-10-19 22:22:36 +09:00

43 lines
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: IPECTER <ipectert@gmail.com>
Date: Wed, 10 May 2023 15:38:58 +0900
Subject: [PATCH] Suppress-Error-From-DirtyAttributes
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 80ab684a33876d62186dcf86f555e46db1594b09..21b18d85563ffd5f93234455dca4dc30582b8925 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -403,8 +403,8 @@ public class ServerEntity {
}
if (this.entity instanceof LivingEntity) {
- Set<AttributeInstance> set = ((LivingEntity) this.entity).getAttributes().getDirtyAttributes();
-
+ Set<AttributeInstance> attributes = ((LivingEntity) this.entity).getAttributes().getDirtyAttributes(); // Plazma - suppress error from dirty attributes
+ final Set<AttributeInstance> set = this.entity.level().plazmaLevelConfiguration().misc.suppressErrorFromDirtyAttributes ? java.util.Collections.synchronizedSet(attributes) : attributes; // Plazma - suppress error from dirty attributes
if (!set.isEmpty()) {
// CraftBukkit start - Send scaled max health
if (this.entity instanceof ServerPlayer) {
@@ -414,7 +414,7 @@ public class ServerEntity {
this.broadcastAndSend(new ClientboundUpdateAttributesPacket(this.entity.getId(), set));
}
- set.clear();
+ attributes.clear();
}
}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
index 6db3defbf2634ae37af12246c17f852e6786d0ba..7d5bfd3a5aa5135596f3f1ae7c504a51b02798ef 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
@@ -89,6 +89,7 @@ public class LevelConfigurations extends ConfigurationPart {
public boolean reduceCreateRandomInstance = DO_OPTIMIZE;
public boolean checkSpectatorMovedToQuickly = DO_OPTIMIZE;
+ public boolean suppressErrorFromDirtyAttributes = false;
}