From 847665c2f28d9ac42e80601fd60414c378896934 Mon Sep 17 00:00:00 2001
From: modmuss50 <modmuss50@gmail.com>
Date: Wed, 29 Jul 2020 20:16:13 +0100
Subject: [PATCH] Fix crash when remapping registries. Closes #967

---
 fabric-registry-sync-v0/build.gradle                            | 2 +-
 .../fabricmc/fabric/mixin/registry/sync/MixinIdRegistry.java    | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/fabric-registry-sync-v0/build.gradle b/fabric-registry-sync-v0/build.gradle
index 40bc2a295..d7940be05 100644
--- a/fabric-registry-sync-v0/build.gradle
+++ b/fabric-registry-sync-v0/build.gradle
@@ -1,5 +1,5 @@
 archivesBaseName = "fabric-registry-sync-v0"
-version = getSubprojectVersion(project, "0.4.0")
+version = getSubprojectVersion(project, "0.4.1")
 
 dependencies {
 	compile project(path: ':fabric-api-base', configuration: 'dev')
diff --git a/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/MixinIdRegistry.java b/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/MixinIdRegistry.java
index 53bdce0c9..3e501d68e 100644
--- a/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/MixinIdRegistry.java
+++ b/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/MixinIdRegistry.java
@@ -341,6 +341,7 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
 			}
 
 			// Add the new object, increment nextId to match.
+			field_26682.size(Math.max(this.field_26682.size(), id + 1));
 			field_26682.set(id, object);
 			field_26683.put(object, id);