mirror of
https://github.com/darksaid98/Flashback.git
synced 2026-12-02 22:17:10 +00:00
Fix error when checking registries of different sizes
This commit is contained in:
1 parent
468b7b4680
commit
ab9b9d4a99
1 file changed
+7
-6
@@ -108,6 +108,10 @@ public class RegistryHelper {
|
|||||||
return registryOne.isEmpty() && registryTwo.isEmpty();
|
return registryOne.isEmpty() && registryTwo.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (registryOne.get().size() != registryTwo.get().size()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return equalsAssumeSameSize(one, two, dynamicOpsOne, dynamicOpsTwo, registryData);
|
return equalsAssumeSameSize(one, two, dynamicOpsOne, dynamicOpsTwo, registryData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,25 +121,22 @@ public class RegistryHelper {
|
|||||||
Optional<? extends Registry<T>> registryTwo = two.lookup(registryData.key());
|
Optional<? extends Registry<T>> registryTwo = two.lookup(registryData.key());
|
||||||
|
|
||||||
if (registryOne.isEmpty() || registryTwo.isEmpty()) {
|
if (registryOne.isEmpty() || registryTwo.isEmpty()) {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator<T> iteratorOne = registryOne.get().iterator();
|
Iterator<T> iteratorOne = registryOne.get().iterator();
|
||||||
Iterator<T> iteratorTwo = registryTwo.get().iterator();
|
Iterator<T> iteratorTwo = registryTwo.get().iterator();
|
||||||
|
|
||||||
boolean matches = true;
|
|
||||||
|
|
||||||
// Do this for every element in order to find dependent registries
|
|
||||||
while (iteratorOne.hasNext()) {
|
while (iteratorOne.hasNext()) {
|
||||||
T valueOne = iteratorOne.next();
|
T valueOne = iteratorOne.next();
|
||||||
T valueTwo = iteratorTwo.next();
|
T valueTwo = iteratorTwo.next();
|
||||||
|
|
||||||
if (!equalsUsingCodec(valueOne, valueTwo, dynamicOpsOne, dynamicOpsTwo, registryData.elementCodec())) {
|
if (!equalsUsingCodec(valueOne, valueTwo, dynamicOpsOne, dynamicOpsTwo, registryData.elementCodec())) {
|
||||||
matches = false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return matches;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T> boolean equalsUsingCodec(T one, T two, RegistryOps<?> dynamicOpsOne, RegistryOps<?> dynamicOpsTwo, Codec<T> codec) {
|
private static <T> boolean equalsUsingCodec(T one, T two, RegistryOps<?> dynamicOpsOne, RegistryOps<?> dynamicOpsTwo, Codec<T> codec) {
|
||||||
|
|||||||
Reference in new issue
Block a user