Avoid CMEs when two chunks render concurrently and (#4668)
access the same map.
This commit is contained in:
@@ -92,12 +92,14 @@ public class CableBusBakedModel implements IBakedModel {
|
|||||||
if (layer == RenderType.getCutout()) {
|
if (layer == RenderType.getCutout()) {
|
||||||
|
|
||||||
// First, handle the cable at the center of the cable bus
|
// First, handle the cable at the center of the cable bus
|
||||||
final List<BakedQuad> cableModel = CABLE_MODEL_CACHE.computeIfAbsent(renderState, k -> {
|
synchronized (CABLE_MODEL_CACHE) {
|
||||||
final List<BakedQuad> model = new ArrayList<>();
|
final List<BakedQuad> cableModel = CABLE_MODEL_CACHE.computeIfAbsent(renderState, k -> {
|
||||||
this.addCableQuads(renderState, model);
|
final List<BakedQuad> model = new ArrayList<>();
|
||||||
return model;
|
this.addCableQuads(renderState, model);
|
||||||
});
|
return model;
|
||||||
quads.addAll(cableModel);
|
});
|
||||||
|
quads.addAll(cableModel);
|
||||||
|
}
|
||||||
|
|
||||||
// Then handle attachments
|
// Then handle attachments
|
||||||
for (Direction facing : Direction.values()) {
|
for (Direction facing : Direction.values()) {
|
||||||
@@ -342,7 +344,9 @@ public class CableBusBakedModel implements IBakedModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void clearCache() {
|
public static void clearCache() {
|
||||||
CABLE_MODEL_CACHE.clear();
|
synchronized (CABLE_MODEL_CACHE) {
|
||||||
|
CABLE_MODEL_CACHE.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user