-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: concurrency issue in ServerEntity#sendDirtyEntityData()
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
patches/server/0063-Fix-Concurrency-issue-in-ServerEntity-sendDirtyEntit.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: bridge <ctibeheerder@gmail.com> | ||
Date: Fri, 23 Aug 2024 22:44:57 +0200 | ||
Subject: [PATCH] Fix Concurrency issue in ServerEntity#sendDirtyEntityData() | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java | ||
index 16373e0c5ea38199fab3eb289bf2a5fcf0dd7439..da03bd8fc88a4bbc756e6335ef0adc15ee6eb97e 100644 | ||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java | ||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java | ||
@@ -3,13 +3,8 @@ package net.minecraft.server.level; | ||
import com.google.common.collect.Lists; | ||
import com.mojang.datafixers.util.Pair; | ||
import com.mojang.logging.LogUtils; | ||
-import java.util.ArrayList; | ||
-import java.util.Collection; | ||
-import java.util.Collections; | ||
-import java.util.Iterator; | ||
-import java.util.List; | ||
-import java.util.Objects; | ||
-import java.util.Set; | ||
+ | ||
+import java.util.*; | ||
import java.util.function.Consumer; | ||
import java.util.stream.Stream; | ||
import javax.annotation.Nullable; | ||
@@ -392,7 +387,7 @@ public class ServerEntity { | ||
} | ||
|
||
if (this.entity instanceof LivingEntity) { | ||
- Set<AttributeInstance> set = ((LivingEntity) this.entity).getAttributes().getDirtyAttributes(); | ||
+ Set<AttributeInstance> set = new HashSet<>(((LivingEntity) this.entity).getAttributes().getDirtyAttributes()); | ||
|
||
if (!set.isEmpty()) { | ||
// CraftBukkit start - Send scaled max health | ||
@@ -403,7 +398,7 @@ public class ServerEntity { | ||
this.broadcastAndSend(new ClientboundUpdateAttributesPacket(this.entity.getId(), set)); | ||
} | ||
|
||
- set.clear(); | ||
+ ((LivingEntity) this.entity).getAttributes().getDirtyAttributes().clear(); | ||
} | ||
|
||
} |