mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2026-03-30 19:51:23 +00:00
Add @Nullable and @NonNull annotations
This commit is contained in:
@@ -21,6 +21,8 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
@@ -36,6 +38,7 @@ public final class ComputerCraftAPI
|
||||
return computerCraft != null;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static String getInstalledVersion()
|
||||
{
|
||||
findCC();
|
||||
@@ -50,6 +53,7 @@ public final class ComputerCraftAPI
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static String getAPIVersion()
|
||||
{
|
||||
return "${version}";
|
||||
@@ -68,7 +72,7 @@ public final class ComputerCraftAPI
|
||||
* available for writing.
|
||||
* @see #createSaveDirMount(World, String, long)
|
||||
*/
|
||||
public static int createUniqueNumberedSaveDir( World world, String parentSubPath )
|
||||
public static int createUniqueNumberedSaveDir( @Nonnull World world, @Nonnull String parentSubPath )
|
||||
{
|
||||
findCC();
|
||||
if( computerCraft_createUniqueNumberedSaveDir != null )
|
||||
@@ -100,7 +104,8 @@ public final class ComputerCraftAPI
|
||||
* @see IMount
|
||||
* @see IWritableMount
|
||||
*/
|
||||
public static IWritableMount createSaveDirMount( World world, String subPath, long capacity )
|
||||
@Nullable
|
||||
public static IWritableMount createSaveDirMount( @Nonnull World world, @Nonnull String subPath, long capacity )
|
||||
{
|
||||
findCC();
|
||||
if( computerCraft_createSaveDirMount != null )
|
||||
@@ -132,7 +137,8 @@ public final class ComputerCraftAPI
|
||||
* @see IComputerAccess#mountWritable(String, IWritableMount)
|
||||
* @see IMount
|
||||
*/
|
||||
public static IMount createResourceMount( Class modClass, String domain, String subPath )
|
||||
@Nullable
|
||||
public static IMount createResourceMount( @Nonnull Class<?> modClass, @Nonnull String domain, @Nonnull String subPath )
|
||||
{
|
||||
findCC();
|
||||
if( computerCraft_createResourceMount != null )
|
||||
@@ -153,7 +159,7 @@ public final class ComputerCraftAPI
|
||||
* @see dan200.computercraft.api.peripheral.IPeripheral
|
||||
* @see dan200.computercraft.api.peripheral.IPeripheralProvider
|
||||
*/
|
||||
public static void registerPeripheralProvider( IPeripheralProvider handler )
|
||||
public static void registerPeripheralProvider( @Nonnull IPeripheralProvider handler )
|
||||
{
|
||||
findCC();
|
||||
if ( computerCraft_registerPeripheralProvider != null)
|
||||
@@ -174,7 +180,7 @@ public final class ComputerCraftAPI
|
||||
* @param upgrade The turtle upgrade to register.
|
||||
* @see dan200.computercraft.api.turtle.ITurtleUpgrade
|
||||
*/
|
||||
public static void registerTurtleUpgrade( ITurtleUpgrade upgrade )
|
||||
public static void registerTurtleUpgrade( @Nonnull ITurtleUpgrade upgrade )
|
||||
{
|
||||
if( upgrade != null )
|
||||
{
|
||||
@@ -196,7 +202,7 @@ public final class ComputerCraftAPI
|
||||
* @param handler The bundled redstone provider to register.
|
||||
* @see dan200.computercraft.api.redstone.IBundledRedstoneProvider
|
||||
*/
|
||||
public static void registerBundledRedstoneProvider( IBundledRedstoneProvider handler )
|
||||
public static void registerBundledRedstoneProvider( @Nonnull IBundledRedstoneProvider handler )
|
||||
{
|
||||
findCC();
|
||||
if( computerCraft_registerBundledRedstoneProvider != null )
|
||||
@@ -219,7 +225,7 @@ public final class ComputerCraftAPI
|
||||
* If there is no block capable of emitting bundled redstone at the location, -1 will be returned.
|
||||
* @see dan200.computercraft.api.redstone.IBundledRedstoneProvider
|
||||
*/
|
||||
public static int getBundledRedstoneOutput( World world, BlockPos pos, EnumFacing side )
|
||||
public static int getBundledRedstoneOutput( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side )
|
||||
{
|
||||
findCC();
|
||||
if( computerCraft_getDefaultBundledRedstoneOutput != null )
|
||||
@@ -239,7 +245,7 @@ public final class ComputerCraftAPI
|
||||
* @param handler The media provider to register.
|
||||
* @see dan200.computercraft.api.media.IMediaProvider
|
||||
*/
|
||||
public static void registerMediaProvider( IMediaProvider handler )
|
||||
public static void registerMediaProvider( @Nonnull IMediaProvider handler )
|
||||
{
|
||||
findCC();
|
||||
if( computerCraft_registerMediaProvider != null )
|
||||
@@ -258,7 +264,7 @@ public final class ComputerCraftAPI
|
||||
* @param handler The turtle permission provider to register.
|
||||
* @see dan200.computercraft.api.permissions.ITurtlePermissionProvider
|
||||
*/
|
||||
public static void registerPermissionProvider( ITurtlePermissionProvider handler )
|
||||
public static void registerPermissionProvider( @Nonnull ITurtlePermissionProvider handler )
|
||||
{
|
||||
findCC();
|
||||
if( computerCraft_registerPermissionProvider != null )
|
||||
@@ -271,7 +277,8 @@ public final class ComputerCraftAPI
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerPocketUpgrade(IPocketUpgrade upgrade) {
|
||||
public static void registerPocketUpgrade( @Nonnull IPocketUpgrade upgrade )
|
||||
{
|
||||
findCC();
|
||||
if(computerCraft_registerPocketUpgrade != null) {
|
||||
try {
|
||||
@@ -331,7 +338,7 @@ public final class ComputerCraftAPI
|
||||
}
|
||||
}
|
||||
|
||||
private static Method findCCMethod( String name, Class[] args )
|
||||
private static Method findCCMethod( String name, Class<?>[] args )
|
||||
{
|
||||
try {
|
||||
if( computerCraft != null )
|
||||
|
||||
Reference in New Issue
Block a user