Fix crash when replacing SimpleRegistry contents ()

* Fix crash when replacing SimpleRegistry contents

* Called .value() two more times

(cherry picked from commit 726b65209a)
This commit is contained in:
Benonardo 2022-09-11 15:16:32 +02:00 committed by modmuss50
parent 5d58937841
commit bb2e04773e

View file

@ -153,8 +153,8 @@ public abstract class MixinIdRegistry<T> extends Registry<T> implements Remappab
} else {
RegistryEntry.Reference<T> oldObject = idToEntry.get(registryId.getValue());
if (oldObject != null && oldObject != object) {
int oldId = entryToRawId.getInt(oldObject);
if (oldObject != null && oldObject.value() != null && oldObject.value() != object) {
int oldId = entryToRawId.getInt(oldObject.value());
if (oldId != id && checkDuplicateKeys) {
throw new RuntimeException("Attempted to register ID " + registryId + " at different raw IDs (" + oldId + ", " + id + ")! If you're trying to override an item, use .set(), not .register()!");