mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-10-20 16:37:39 +00:00
Add @Nullable and @NonNull annotations
This commit is contained in:
@@ -11,6 +11,9 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Represents an item that can be placed in a disk drive and used by a Computer.
|
||||
* Implement this interface on your Item class to allow it to be used in the drive.
|
||||
@@ -23,7 +26,8 @@ public interface IMedia
|
||||
* @param stack The itemstack to inspect.
|
||||
* @return The label. ie: "Dan's Programs".
|
||||
*/
|
||||
public String getLabel( ItemStack stack );
|
||||
@Nullable
|
||||
String getLabel( @Nonnull ItemStack stack );
|
||||
|
||||
/**
|
||||
* Set a string representing the label of this item. Will be called vi {@code disk.setLabel()} in lua.
|
||||
@@ -32,7 +36,7 @@ public interface IMedia
|
||||
* @param label The string to set the label to.
|
||||
* @return true if the label was updated, false if the label may not be modified.
|
||||
*/
|
||||
public boolean setLabel( ItemStack stack, String label );
|
||||
boolean setLabel( @Nonnull ItemStack stack, @Nullable String label );
|
||||
|
||||
/**
|
||||
* If this disk represents an item with audio (like a record), get the readable name of the audio track. ie:
|
||||
@@ -41,7 +45,8 @@ public interface IMedia
|
||||
* @param stack The itemstack to inspect.
|
||||
* @return The name, or null if this item does not represent an item with audio.
|
||||
*/
|
||||
public String getAudioTitle( ItemStack stack );
|
||||
@Nullable
|
||||
String getAudioTitle( @Nonnull ItemStack stack );
|
||||
|
||||
/**
|
||||
* If this disk represents an item with audio (like a record), get the resource name of the audio track to play.
|
||||
@@ -49,7 +54,8 @@ public interface IMedia
|
||||
* @param stack The itemstack to inspect.
|
||||
* @return The name, or null if this item does not represent an item with audio.
|
||||
*/
|
||||
public SoundEvent getAudio( ItemStack stack );
|
||||
@Nullable
|
||||
SoundEvent getAudio( @Nonnull ItemStack stack );
|
||||
|
||||
/**
|
||||
* If this disk represents an item with data (like a floppy disk), get a mount representing it's contents. This will
|
||||
@@ -64,5 +70,6 @@ public interface IMedia
|
||||
* @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String, long)
|
||||
* @see dan200.computercraft.api.ComputerCraftAPI#createResourceMount(Class, String, String)
|
||||
*/
|
||||
public IMount createDataMount( ItemStack stack, World world );
|
||||
@Nullable
|
||||
IMount createDataMount( @Nonnull ItemStack stack, @Nonnull World world );
|
||||
}
|
||||
|
Reference in New Issue
Block a user