mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-11-22 08:04:49 +00:00
Add @Nullable and @NonNull annotations
This commit is contained in:
@@ -12,6 +12,8 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class ContainerDiskDrive extends Container
|
||||
{
|
||||
private final TileDiskDrive m_diskDrive;
|
||||
@@ -36,7 +38,7 @@ public class ContainerDiskDrive extends Container
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith( EntityPlayer player )
|
||||
public boolean canInteractWith( @Nonnull EntityPlayer player )
|
||||
{
|
||||
return m_diskDrive.isUseableByPlayer( player );
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ import dan200.computercraft.shared.util.StringUtil;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class DiskDrivePeripheral implements IPeripheral
|
||||
{
|
||||
private final TileDiskDrive m_diskDrive;
|
||||
@@ -25,12 +27,14 @@ public class DiskDrivePeripheral implements IPeripheral
|
||||
m_diskDrive = diskDrive;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return "drive";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String[] getMethodNames()
|
||||
{
|
||||
@@ -50,7 +54,7 @@ public class DiskDrivePeripheral implements IPeripheral
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] callMethod( IComputerAccess computer, ILuaContext context, int method, Object[] arguments ) throws LuaException
|
||||
public Object[] callMethod( @Nonnull IComputerAccess computer, @Nonnull ILuaContext context, int method, @Nonnull Object[] arguments ) throws LuaException
|
||||
{
|
||||
switch( method )
|
||||
{
|
||||
@@ -174,13 +178,13 @@ public class DiskDrivePeripheral implements IPeripheral
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attach( IComputerAccess computer )
|
||||
public void attach( @Nonnull IComputerAccess computer )
|
||||
{
|
||||
m_diskDrive.mount( computer );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach( IComputerAccess computer )
|
||||
public void detach( @Nonnull IComputerAccess computer )
|
||||
{
|
||||
m_diskDrive.unmount( computer );
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import net.minecraft.util.math.*;
|
||||
import net.minecraft.util.text.*;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
@@ -145,6 +146,7 @@ public class TileDiskDrive extends TilePeripheralBase
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
@@ -320,6 +322,7 @@ public class TileDiskDrive extends TilePeripheralBase
|
||||
return getLabel() != null;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
@@ -334,6 +337,7 @@ public class TileDiskDrive extends TilePeripheralBase
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ITextComponent getDisplayName()
|
||||
{
|
||||
@@ -354,23 +358,23 @@ public class TileDiskDrive extends TilePeripheralBase
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory( EntityPlayer player )
|
||||
public void openInventory( @Nonnull EntityPlayer player )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory( EntityPlayer player )
|
||||
public void closeInventory( @Nonnull EntityPlayer player )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack)
|
||||
public boolean isItemValidForSlot( int i, @Nonnull ItemStack itemstack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer( EntityPlayer player )
|
||||
public boolean isUseableByPlayer( @Nonnull EntityPlayer player )
|
||||
{
|
||||
return isUsable( player, false );
|
||||
}
|
||||
@@ -613,7 +617,7 @@ public class TileDiskDrive extends TilePeripheralBase
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void readDescription( NBTTagCompound nbttagcompound )
|
||||
public final void readDescription( @Nonnull NBTTagCompound nbttagcompound )
|
||||
{
|
||||
super.readDescription( nbttagcompound );
|
||||
if( nbttagcompound.hasKey( "item" ) )
|
||||
@@ -628,7 +632,7 @@ public class TileDiskDrive extends TilePeripheralBase
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeDescription( NBTTagCompound nbttagcompound )
|
||||
public void writeDescription( @Nonnull NBTTagCompound nbttagcompound )
|
||||
{
|
||||
super.writeDescription( nbttagcompound );
|
||||
if( m_diskStack != null )
|
||||
@@ -659,7 +663,7 @@ public class TileDiskDrive extends TilePeripheralBase
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRefresh( World world, BlockPos pos, IBlockState oldState, IBlockState newState )
|
||||
public boolean shouldRefresh( World world, BlockPos pos, @Nonnull IBlockState oldState, @Nonnull IBlockState newState )
|
||||
{
|
||||
return super.shouldRefresh( world, pos, oldState, newState ) || ComputerCraft.Blocks.peripheral.getPeripheralType( newState ) != PeripheralType.DiskDrive;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user