Fix docs some more

This commit is contained in:
Raoul Van den Berge
2016-06-26 23:35:55 +02:00
parent 5b3cde7675
commit 73a96ee2cd
8 changed files with 106 additions and 11 deletions

View File

@@ -4,16 +4,41 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
/**
* Represents a crafting pattern.
*/
public interface ICraftingPattern { public interface ICraftingPattern {
/**
* @param world The world
* @return Returns the container where the pattern is in
*/
ICraftingPatternContainer getContainer(World world); ICraftingPatternContainer getContainer(World world);
/**
* @return If this pattern is a processing pattern
*/
boolean isProcessing(); boolean isProcessing();
/**
* @return The inputs
*/
ItemStack[] getInputs(); ItemStack[] getInputs();
/**
* @return The outputs
*/
ItemStack[] getOutputs(); ItemStack[] getOutputs();
/**
* @return The byproducts
*/
ItemStack[] getByproducts(); ItemStack[] getByproducts();
/**
* Writes this pattern to NBT.
*
* @param tag The NBT tag
* @return The NBT tag
*/
NBTTagCompound writeToNBT(NBTTagCompound tag); NBTTagCompound writeToNBT(NBTTagCompound tag);
} }

View File

@@ -2,8 +2,19 @@ package refinedstorage.api.autocrafting;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
/**
* Represents the container where the pattern is in.
*/
public interface ICraftingPatternContainer { public interface ICraftingPatternContainer {
/**
* This usually corresponds to the amount of speed upgrades in a crafter.
*
* @return The speed of this pattern
*/
int getSpeed(); int getSpeed();
/**
* @return The {@link IItemHandler} that this container is facing
*/
IItemHandler getConnectedItems(); IItemHandler getConnectedItems();
} }

View File

@@ -4,16 +4,50 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
import refinedstorage.api.network.INetworkMaster; import refinedstorage.api.network.INetworkMaster;
/**
* Represents a crafting task.
*/
public interface ICraftingTask { public interface ICraftingTask {
/**
* @return The pattern
*/
ICraftingPattern getPattern(); ICraftingPattern getPattern();
/**
* @param world The world
* @param network The network
* @return If the crafting task is done
*/
boolean update(World world, INetworkMaster network); boolean update(World world, INetworkMaster network);
/**
* Gets called as soon as {@link ICraftingTask#update(World, INetworkMaster)} returns true.
*
* @param network The network
*/
void onDone(INetworkMaster network); void onDone(INetworkMaster network);
/**
* Gets called when this crafting task is cancelled.
*
* @param network The network
*/
void onCancelled(INetworkMaster network); void onCancelled(INetworkMaster network);
/**
* Writes this crafting task to NBT.
*
* @param tag The NBT tag
*/
void writeToNBT(NBTTagCompound tag); void writeToNBT(NBTTagCompound tag);
/**
* Returns the info string that the crafting monitor uses.
* Separate every line by the newline character.
* Use T=x where x is the translation key for translating.
* Use I=x where x is the translation key for translating and displaying the line in yellow.
*
* @return The info string
*/
String getInfo(); String getInfo();
} }

View File

@@ -8,6 +8,7 @@ import refinedstorage.api.autocrafting.ICraftingPattern;
import refinedstorage.api.autocrafting.ICraftingTask; import refinedstorage.api.autocrafting.ICraftingTask;
import refinedstorage.api.storage.CompareFlags; import refinedstorage.api.storage.CompareFlags;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
@@ -40,12 +41,12 @@ public interface INetworkMaster {
/** /**
* @param slave The slave to add * @param slave The slave to add
*/ */
void addSlave(INetworkSlave slave); void addSlave(@Nonnull INetworkSlave slave);
/** /**
* @param slave The slave to remove * @param slave The slave to remove
*/ */
void removeSlave(INetworkSlave slave); void removeSlave(@Nonnull INetworkSlave slave);
/** /**
* @return The grid handler for this network * @return The grid handler for this network
@@ -72,14 +73,14 @@ public interface INetworkMaster {
* *
* @param task The crafting task to add * @param task The crafting task to add
*/ */
void addCraftingTask(ICraftingTask task); void addCraftingTask(@Nonnull ICraftingTask task);
/** /**
* Adds a crafting task to the bottom of the crafting task stack. * Adds a crafting task to the bottom of the crafting task stack.
* *
* @param task The crafting task to add as last * @param task The crafting task to add as last
*/ */
void addCraftingTaskAsLast(ICraftingTask task); void addCraftingTaskAsLast(@Nonnull ICraftingTask task);
/** /**
* Creates a crafting task from a pattern. * Creates a crafting task from a pattern.
@@ -87,14 +88,14 @@ public interface INetworkMaster {
* @param pattern The pattern to create a task for * @param pattern The pattern to create a task for
* @return A task * @return A task
*/ */
ICraftingTask createCraftingTask(ICraftingPattern pattern); ICraftingTask createCraftingTask(@Nonnull ICraftingPattern pattern);
/** /**
* Cancels a crafting task. * Cancels a crafting task.
* *
* @param task The task to cancel * @param task The task to cancel
*/ */
void cancelCraftingTask(ICraftingTask task); void cancelCraftingTask(@Nonnull ICraftingTask task);
/** /**
* @return A list of crafting patterns in this network, do NOT modify this list * @return A list of crafting patterns in this network, do NOT modify this list
@@ -113,8 +114,9 @@ public interface INetworkMaster {
/** /**
* @param pattern The {@link ItemStack} to get a pattern for * @param pattern The {@link ItemStack} to get a pattern for
* @param flags The flags to compare on, see {@link CompareFlags} * @param flags The flags to compare on, see {@link CompareFlags}
* @return The pattern * @return The pattern, or null if the pattern is not found
*/ */
@Nullable
ICraftingPattern getPattern(ItemStack pattern, int flags); ICraftingPattern getPattern(ItemStack pattern, int flags);
/** /**
@@ -135,7 +137,8 @@ public interface INetworkMaster {
* @param simulate If we are simulating * @param simulate If we are simulating
* @return null if the push was successful, or a {@link ItemStack} with the remainder * @return null if the push was successful, or a {@link ItemStack} with the remainder
*/ */
ItemStack push(ItemStack stack, int size, boolean simulate); @Nullable
ItemStack push(@Nonnull ItemStack stack, int size, boolean simulate);
/** /**
* Takes an item from this network. * Takes an item from this network.
@@ -145,7 +148,8 @@ public interface INetworkMaster {
* @param flags The flags to compare on, see {@link CompareFlags} * @param flags The flags to compare on, see {@link CompareFlags}
* @return null if we didn't takeFromNetwork anything, or a {@link ItemStack} with the result * @return null if we didn't takeFromNetwork anything, or a {@link ItemStack} with the result
*/ */
ItemStack take(ItemStack stack, int size, int flags); @Nullable
ItemStack take(@Nonnull ItemStack stack, int size, int flags);
/** /**
* Returns an item from storage, based on the given prototype. * Returns an item from storage, based on the given prototype.
@@ -155,5 +159,5 @@ public interface INetworkMaster {
* @return The {@link ItemStack} we found, do NOT modify * @return The {@link ItemStack} we found, do NOT modify
*/ */
@Nullable @Nullable
ItemStack getItem(ItemStack stack, int flags); ItemStack getItem(@Nonnull ItemStack stack, int flags);
} }

View File

@@ -36,6 +36,7 @@ public interface INetworkSlave {
/** /**
* Called when a connection is found to the network * Called when a connection is found to the network
*
* @param world The world * @param world The world
* @param network The network we're trying to connect to * @param network The network we're trying to connect to
*/ */

View File

@@ -12,20 +12,34 @@ public class WirelessGridConsumer {
private EnumHand hand; private EnumHand hand;
private ItemStack wirelessGrid; private ItemStack wirelessGrid;
/**
* @param player The player using this wireless grid
* @param hand The hand that this wireless grid is in
* @param wirelessGrid The wireless grid {@link ItemStack} in the player's inventory
*/
public WirelessGridConsumer(EntityPlayer player, EnumHand hand, ItemStack wirelessGrid) { public WirelessGridConsumer(EntityPlayer player, EnumHand hand, ItemStack wirelessGrid) {
this.player = player; this.player = player;
this.hand = hand; this.hand = hand;
this.wirelessGrid = wirelessGrid; this.wirelessGrid = wirelessGrid;
} }
/**
* @return The wireless grid {@link ItemStack}
*/
public ItemStack getWirelessGrid() { public ItemStack getWirelessGrid() {
return wirelessGrid; return wirelessGrid;
} }
/**
* @return The hand this wireless grid is in
*/
public EnumHand getHand() { public EnumHand getHand() {
return hand; return hand;
} }
/**
* @return The player using the wireless grid
*/
public EntityPlayer getPlayer() { public EntityPlayer getPlayer() {
return player; return player;
} }

View File

@@ -3,6 +3,7 @@ package refinedstorage.api.storage;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List; import java.util.List;
/** /**
@@ -26,6 +27,7 @@ public interface IStorage {
* @param simulate If we are simulating * @param simulate If we are simulating
* @return null if the push was successful, or a {@link ItemStack} with the remainder * @return null if the push was successful, or a {@link ItemStack} with the remainder
*/ */
@Nullable
ItemStack push(@Nonnull ItemStack stack, int size, boolean simulate); ItemStack push(@Nonnull ItemStack stack, int size, boolean simulate);
/** /**
@@ -38,6 +40,7 @@ public interface IStorage {
* @param flags On what we are comparing to takeFromNetwork the item, see {@link CompareFlags} * @param flags On what we are comparing to takeFromNetwork the item, see {@link CompareFlags}
* @return null if we didn't takeFromNetwork anything, or a {@link ItemStack} with the result * @return null if we didn't takeFromNetwork anything, or a {@link ItemStack} with the result
*/ */
@Nullable
ItemStack take(@Nonnull ItemStack stack, int size, int flags); ItemStack take(@Nonnull ItemStack stack, int size, int flags);
/** /**

View File

@@ -2,6 +2,9 @@ package refinedstorage.api.storage;
import java.util.List; import java.util.List;
/**
* Implement this interface on the tile that has a {@link refinedstorage.api.RefinedStorageCapabilities#NETWORK_SLAVE_CAPABILITY} capability.
*/
public interface IStorageProvider { public interface IStorageProvider {
/** /**
* @param storages A list containing previously added storages * @param storages A list containing previously added storages