Use UnsafeHacks to construct the test function info

This has been stripped (only in CI on 1.15, always in 1.16) so blows up
when we try to call it.
This commit is contained in:
Jonathan Coates 2021-01-09 20:12:13 +00:00
parent 88f5b20353
commit f78e24f9a0
2 changed files with 2 additions and 6 deletions

View File

@ -12,10 +12,10 @@
import net.minecraft.test.TestTrackerHolder;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.fml.unsafe.UnsafeHacks;
import net.minecraftforge.forgespi.language.ModFileScanData;
import org.objectweb.asm.Type;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
@ -89,10 +89,7 @@ private static TestFunctionInfo createTestFunction(
{
try
{
Constructor<TestFunctionInfo> ctor = TestFunctionInfo.class.getDeclaredConstructor();
ctor.setAccessible( true );
TestFunctionInfo func = ctor.newInstance();
TestFunctionInfo func = UnsafeHacks.newInstance( TestFunctionInfo.class );
setFinalField( func, "batchName", batchName );
setFinalField( func, "testName", testName );
setFinalField( func, "structureName", structureName );

View File

@ -15,4 +15,3 @@ displayName="CC: Tweaked test framework"
description='''
A test framework for ensuring CC: Tweaked works correctly.
'''