Merge 1.20 into 1.20.2

This commit is contained in:
embeddedt 2023-12-03 19:28:56 -05:00
commit bfdd1f913d
No known key found for this signature in database
GPG Key ID: A69433EC199B5613

View File

@ -1,5 +1,6 @@
package org.embeddedt.modernfix.forge.mixin.perf.fast_registry_validation;
import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
import net.minecraftforge.registries.ForgeRegistry;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.Marker;
@ -9,10 +10,27 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.BitSet;
import java.lang.reflect.Method;
import java.util.*;
@Mixin(value = ForgeRegistry.class, remap = false)
public class ForgeRegistryMixin<V> {
private static Method bitSetTrimMethod = null;
private static boolean bitSetTrimMethodRetrieved = false;
/**
* Cache the result of findMethod instead of running it multiple times.
* Null checks are not required as the surrounding code handles it already.
*/
@Redirect(method = "validateContent", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/util/ObfuscationReflectionHelper;findMethod(Ljava/lang/Class;Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;"), require = 0)
private Method skipMultipleRemap(Class<?> clz, String methodName, Class<?>[] params) {
if(!bitSetTrimMethodRetrieved) {
bitSetTrimMethodRetrieved = true;
bitSetTrimMethod = ObfuscationReflectionHelper.findMethod(clz, methodName, params);
}
return bitSetTrimMethod;
}
private int expectedNextBit = -1;
/**