mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-12-02 20:38:05 +00:00
Make executeMainThreadTask a default method
- Move TaskCallback into the API and make it package private. This effectively means it's not an API class, just exists there for convenience reasons. - Replace any usage of TaskCallback.make with ILuaContext.executeMainThreadTask. - Some minor formatting/checkstyle changes to bring us inline with IntelliJ config.
This commit is contained in:
@@ -8,7 +8,6 @@ package dan200.computercraft.core.apis;
|
||||
import dan200.computercraft.api.lua.*;
|
||||
import dan200.computercraft.core.asm.LuaMethod;
|
||||
import dan200.computercraft.core.asm.NamedMethod;
|
||||
import dan200.computercraft.core.asm.TaskCallback;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.HashMap;
|
||||
@@ -65,11 +64,4 @@ public class ObjectWrapper implements ILuaContext
|
||||
{
|
||||
throw new IllegalStateException( "Method should never queue events" );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public MethodResult executeMainThreadTask( @Nonnull ILuaTask task ) throws LuaException
|
||||
{
|
||||
return TaskCallback.make( this, task );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ public class GeneratorTest
|
||||
{
|
||||
@LuaFunction
|
||||
public final void go()
|
||||
{ }
|
||||
{}
|
||||
}
|
||||
|
||||
public static class Basic2 extends Basic
|
||||
@@ -139,14 +139,14 @@ public class GeneratorTest
|
||||
{
|
||||
@LuaFunction
|
||||
public final void go()
|
||||
{ }
|
||||
{}
|
||||
}
|
||||
|
||||
public static class NonInstance
|
||||
{
|
||||
@LuaFunction
|
||||
public static void go()
|
||||
{ }
|
||||
{}
|
||||
}
|
||||
|
||||
public static class IllegalThrows
|
||||
@@ -162,42 +162,42 @@ public class GeneratorTest
|
||||
{
|
||||
@LuaFunction( { "go1", "go2" } )
|
||||
public final void go()
|
||||
{ }
|
||||
{}
|
||||
}
|
||||
|
||||
public static class ArgKinds
|
||||
{
|
||||
@LuaFunction
|
||||
public final void objectArg( Object arg )
|
||||
{ }
|
||||
{}
|
||||
|
||||
@LuaFunction
|
||||
public final void intArg( int arg )
|
||||
{ }
|
||||
{}
|
||||
|
||||
@LuaFunction
|
||||
public final void optIntArg( Optional<Integer> arg )
|
||||
{ }
|
||||
{}
|
||||
|
||||
@LuaFunction
|
||||
public final void context( ILuaContext arg )
|
||||
{ }
|
||||
{}
|
||||
|
||||
@LuaFunction
|
||||
public final void arguments( IArguments arg )
|
||||
{ }
|
||||
{}
|
||||
|
||||
@LuaFunction
|
||||
public final void unknown( IComputerAccess arg )
|
||||
{ }
|
||||
{}
|
||||
|
||||
@LuaFunction
|
||||
public final void illegalMap( Map<String, Integer> arg )
|
||||
{ }
|
||||
{}
|
||||
|
||||
@LuaFunction
|
||||
public final void optIllegalMap( Optional<Map<String, Integer>> arg )
|
||||
{ }
|
||||
{}
|
||||
}
|
||||
|
||||
public static class EnumMethods
|
||||
@@ -219,7 +219,7 @@ public class GeneratorTest
|
||||
{
|
||||
@LuaFunction( mainThread = true )
|
||||
public final void go()
|
||||
{ }
|
||||
{}
|
||||
}
|
||||
|
||||
private static <T> T find( Collection<NamedMethod<T>> methods, String name )
|
||||
@@ -256,12 +256,5 @@ public class GeneratorTest
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public MethodResult executeMainThreadTask( @Nonnull ILuaTask task ) throws LuaException
|
||||
{
|
||||
return TaskCallback.make( this, task );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user