mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-27 02:39:09 +00:00
Fix MC-183518
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
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 b38207981751d96a7e769f7afb352a4540b18440..3117a5ea9ef02c523c9223252078cc40163e6ca4 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -402,7 +402,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
|
||||
@@ -413,7 +416,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);
|
||||
+ }
|
||||
}
|
||||
Reference in New Issue
Block a user