From 17eb8845f3c8c58a32cc8d5179673dddc7a6304d Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Tue, 1 Feb 2022 09:47:46 +0000 Subject: [PATCH] Use a CHM for StructureTemplate.Pallete cache fixes a CME due to this collection being shared across threads This patch was in 1.16.5 for a good while and noticed somebody getting impacted by the same thing --- ...-for-StructureTemplate.Pallete-cache.patch | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 patches/server/0860-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch diff --git a/patches/server/0860-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch b/patches/server/0860-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch new file mode 100644 index 000000000..7380887e9 --- /dev/null +++ b/patches/server/0860-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Mon, 12 Jul 2021 12:28:29 +0100 +Subject: [PATCH] Use a CHM for StructureTemplate.Pallete cache + +fixes a CME due to this collection being shared across threads + +diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +index ef8dd3fa4f7ac8f85ae508999264850659bf9606..ac80779956ac2f8aa83166d3d2282352ebe1901d 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +@@ -831,7 +831,7 @@ public class StructureTemplate { + public static final class Palette { + + private final List blocks; +- private final Map> cache = Maps.newHashMap(); ++ private final Map> cache = Maps.newConcurrentMap(); // Paper + + Palette(List infos) { + this.blocks = infos;