Merge 1.20 into 1.20.2
This commit is contained in:
commit
bfdd1f913d
|
|
@ -1,5 +1,6 @@
|
||||||
package org.embeddedt.modernfix.forge.mixin.perf.fast_registry_validation;
|
package org.embeddedt.modernfix.forge.mixin.perf.fast_registry_validation;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
|
||||||
import net.minecraftforge.registries.ForgeRegistry;
|
import net.minecraftforge.registries.ForgeRegistry;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.apache.logging.log4j.Marker;
|
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.Redirect;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
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)
|
@Mixin(value = ForgeRegistry.class, remap = false)
|
||||||
public class ForgeRegistryMixin<V> {
|
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;
|
private int expectedNextBit = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user