13
0
geforkt von Mirrors/Paper

Use a CHM for StructureTemplate.Pallete cache

fixes a CME due to this collection being shared across threads
Dieser Commit ist enthalten in:
Shane Freeder 2021-07-12 12:28:29 +01:00
Ursprung cf0525cba8
Commit 0202f1788d

Datei anzeigen

@ -18,18 +18,18 @@
public class StructureTemplate {
@@ -73,6 +77,11 @@
public final List<StructureTemplate.StructureEntityInfo> entityInfoList = Lists.newArrayList();
@@ -74,6 +78,11 @@
private Vec3i size;
private String author;
+
+ // CraftBukkit start - data containers
+ private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
+ public CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(StructureTemplate.DATA_TYPE_REGISTRY);
+ // CraftBukkit end
+
public StructureTemplate() {
this.size = Vec3i.ZERO;
this.author = "?";
@@ -147,7 +156,7 @@
}
@ -141,6 +141,15 @@
}
private void loadPalette(HolderGetter<Block> blockLookup, ListTag palette, ListTag blocks) {
@@ -840,7 +889,7 @@
public static final class Palette {
private final List<StructureTemplate.StructureBlockInfo> blocks;
- private final Map<Block, List<StructureTemplate.StructureBlockInfo>> cache = Maps.newHashMap();
+ private final Map<Block, List<StructureTemplate.StructureBlockInfo>> cache = Maps.newConcurrentMap(); // Paper - Fix CME due to this collection being shared across threads
@Nullable
private List<StructureTemplate.JigsawBlockInfo> cachedJigsaws;
@@ -924,7 +973,7 @@
public BlockState stateFor(int id) {
BlockState iblockdata = (BlockState) this.ids.byId(id);