diff --git a/src/main/java/codechicken/lib/render/pipeline/IVertexOperation.java b/src/main/java/codechicken/lib/render/pipeline/IVertexOperation.java index a8a4c247..00b74a87 100644 --- a/src/main/java/codechicken/lib/render/pipeline/IVertexOperation.java +++ b/src/main/java/codechicken/lib/render/pipeline/IVertexOperation.java @@ -8,7 +8,7 @@ public interface IVertexOperation { static int registerOperation() { - return VertexOperationRegistry.nextOperationIndex++; + return VertexOperationRegistry.nextOperationIndex(); } static int operationCount() { @@ -35,5 +35,9 @@ static int operationCount() { class VertexOperationRegistry { static int nextOperationIndex; + + private static synchronized int nextOperationIndex() { + return VertexOperationRegistry.nextOperationIndex++; + } } } diff --git a/src/main/java/codechicken/lib/render/pipeline/attribute/AttributeKey.java b/src/main/java/codechicken/lib/render/pipeline/attribute/AttributeKey.java index 6c35d681..2cc2a4a3 100644 --- a/src/main/java/codechicken/lib/render/pipeline/attribute/AttributeKey.java +++ b/src/main/java/codechicken/lib/render/pipeline/attribute/AttributeKey.java @@ -93,7 +93,7 @@ public static class AttributeKeyRegistry { private static final Map> nameMap = new HashMap<>(); private static final List> attributeKeys = new ArrayList<>(); - private static int registerAttributeKey(AttributeKey attr) { + private static synchronized int registerAttributeKey(AttributeKey attr) { if (nameMap.containsKey(attr.name)) { throw new IllegalArgumentException("Duplicate registration of attribute with name: " + attr.name); }