fix: circular init :|

This commit is contained in:
mworzala 2024-04-25 08:49:31 -04:00
parent c29fe5a10a
commit 95c5f6675f
No known key found for this signature in database
GPG Key ID: B148F922E64797C7
1 changed files with 1 additions and 3 deletions

View File

@ -22,8 +22,6 @@ import java.util.Map;
record ItemComponentPatch(@NotNull Int2ObjectMap<Object> patch) {
private static final char REMOVAL_PREFIX = '!';
static final int MAX_SIZE = ItemComponent.values().size() * 2;
public static final ItemComponentPatch EMPTY = new ItemComponentPatch(new Int2ObjectArrayMap<>(0));
public static final @NotNull NetworkBuffer.Type<ItemComponentPatch> NETWORK_TYPE = new NetworkBuffer.Type<>() {
@ -56,7 +54,7 @@ record ItemComponentPatch(@NotNull Int2ObjectMap<Object> patch) {
public ItemComponentPatch read(@NotNull NetworkBuffer buffer) {
int added = buffer.read(NetworkBuffer.VAR_INT);
int removed = buffer.read(NetworkBuffer.VAR_INT);
Check.stateCondition(added + removed > MAX_SIZE, "Item component patch too large: {0}", added + removed);
Check.stateCondition(added + removed > ItemComponent.values().size() * 2, "Item component patch too large: {0}", added + removed);
Int2ObjectMap<Object> patch = new Int2ObjectArrayMap<>(added + removed);
for (int i = 0; i < added; i++) {
int id = buffer.read(NetworkBuffer.VAR_INT);