Files
PlazmaBukkitMC/patches/server/0032-Suppress-errors-from-dirty-attributes.patch
AlphaKR93 33701c1eca more work
2024-11-02 16:39:08 +09:00

42 lines
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Fri, 25 Oct 2024 19:26:15 +0900
Subject: [PATCH] Suppress errors from dirty attributes
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index bf5633f387e268191e2a33be2dcec6c514c0766f..4653b25a818ebe18980864e6e450bd0ab8db99e9 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1377,7 +1377,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
private void refreshDirtyAttributes() {
- Set<AttributeInstance> set = this.getAttributes().getAttributesToUpdate();
+ Set<AttributeInstance> attr = this.getAttributes().getAttributesToUpdate(); // Plazma - Suppress errors from dirty attributes
+ final Set<AttributeInstance> set = level().plazmaConfig().entity.suppressErrorsFromDirtyAttributes ? java.util.Collections.synchronizedSet(attr) : attr; // Plazma - Suppress errors from dirty attributes
Iterator iterator = set.iterator();
while (iterator.hasNext()) {
@@ -1386,7 +1387,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.onAttributeUpdated(attributemodifiable.getAttribute());
}
- set.clear();
+ attr.clear(); // Plazma - Suppress errors from dirty attributes
}
protected void onAttributeUpdated(Holder<Attribute> attribute) {
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index 0618db9893eda1fac0da6b771cc4d456b247d237..bd795efde3b34371e54df881be39891a344d44fd 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -29,6 +29,7 @@ public class WorldConfigurations extends ConfigurationPart {
public class Entity extends ConfigurationPart {
public int sensorTick = 1;
+ public boolean suppressErrorsFromDirtyAttributes = OPTIMIZE;
public Phantom phantom;
public class Phantom extends ConfigurationPart {