9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-22 00:09:15 +00:00
Files
DivineMC/patches/server/0032-Suppress-errors-from-dirty-attributes.patch
NONPLAYT 16f429723b Updated Upstream (Purpur)
Upstream has released updates that appear to apply and compile correctly

Purpur Changes:
PurpurMC/Purpur@998a4e6 [ci skip] add a good chunk of patch identifying comments
PurpurMC/Purpur@e440784 [ci skip] a couple more patch identifying comments
PurpurMC/Purpur@c33391b Updated Upstream (Paper)
PurpurMC/Purpur@8d7fab1 [ci skip] small patch comment cleanup
2024-12-16 20:56:44 +03:00

46 lines
2.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Sun, 14 Jan 2024 22:58:43 +0300
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 2bec5ed591e658765602379f9065b8089f5df6ea..944de5ff109b15b76b69326e69b6b1c2afb63dd1 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -455,7 +455,10 @@ public class ServerEntity {
}
if (this.entity instanceof LivingEntity) {
- Set<AttributeInstance> set = ((LivingEntity) this.entity).getAttributes().getAttributesToSync();
+ // DivineMC start - Suppress errors from dirty attributes
+ Set<AttributeInstance> attributes = ((LivingEntity) this.entity).getAttributes().getAttributesToSync();
+ final Set<AttributeInstance> set = this.level.divinemcConfig.suppressErrorsFromDirtyAttributes ? Collections.synchronizedSet(attributes) : attributes;
+ // DivineMC end
if (!set.isEmpty()) {
// CraftBukkit start - Send scaled max health
@@ -466,7 +469,7 @@ public class ServerEntity {
this.broadcastAndSend(new ClientboundUpdateAttributesPacket(this.entity.getId(), set));
}
- set.clear();
+ attributes.clear(); // DivineMC
}
}
diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
index 242da697c957508c8e75bfd232c44ea34ba3a62a..d94c51ea18d299dd52b9a8521a9cdc0d95b79356 100644
--- a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
@@ -101,4 +101,9 @@ public class DivineWorldConfig {
snowballCanKnockback = getBoolean("gameplay-mechanics.projectiles.snowball.knockback", snowballCanKnockback);
eggCanKnockback = getBoolean("gameplay-mechanics.projectiles.egg.knockback", eggCanKnockback);
}
+
+ public boolean suppressErrorsFromDirtyAttributes = true;
+ private void suppressErrorsFromDirtyAttributes() {
+ suppressErrorsFromDirtyAttributes = getBoolean("suppress-errors-from-dirty-attributes", suppressErrorsFromDirtyAttributes);
+ }
}