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.world.World;
/**
* Represents a crafting pattern.
*/
public interface ICraftingPattern {
/**
* @param world The world
* @return Returns the container where the pattern is in
*/
ICraftingPatternContainer getContainer(World world);
/**
* @return If this pattern is a processing pattern
*/
boolean isProcessing();
/**
* @return The inputs
*/
ItemStack[] getInputs();
/**
* @return The outputs
*/
ItemStack[] getOutputs();
/**
* @return The byproducts
*/
ItemStack[] getByproducts();
/**
* Writes this pattern to NBT.
*
* @param tag The NBT tag
* @return The NBT tag
*/
NBTTagCompound writeToNBT(NBTTagCompound tag);
}

View File

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

View File

@@ -4,16 +4,50 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import refinedstorage.api.network.INetworkMaster;
/**
* Represents a crafting task.
*/
public interface ICraftingTask {
/**
* @return The pattern
*/
ICraftingPattern getPattern();
/**
* @param world The world
* @param network The network
* @return If the crafting task is done
*/
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);
/**
* Gets called when this crafting task is cancelled.
*
* @param network The network
*/
void onCancelled(INetworkMaster network);
/**
* Writes this crafting task to NBT.
*
* @param tag The NBT 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();
}

View File

@@ -8,6 +8,7 @@ import refinedstorage.api.autocrafting.ICraftingPattern;
import refinedstorage.api.autocrafting.ICraftingTask;
import refinedstorage.api.storage.CompareFlags;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
@@ -40,12 +41,12 @@ public interface INetworkMaster {
/**
* @param slave The slave to add
*/
void addSlave(INetworkSlave slave);
void addSlave(@Nonnull INetworkSlave slave);
/**
* @param slave The slave to remove
*/
void removeSlave(INetworkSlave slave);
void removeSlave(@Nonnull INetworkSlave slave);
/**
* @return The grid handler for this network
@@ -72,14 +73,14 @@ public interface INetworkMaster {
*
* @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.
*
* @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.
@@ -87,14 +88,14 @@ public interface INetworkMaster {
* @param pattern The pattern to create a task for
* @return A task
*/
ICraftingTask createCraftingTask(ICraftingPattern pattern);
ICraftingTask createCraftingTask(@Nonnull ICraftingPattern pattern);
/**
* Cancels a crafting task.
*
* @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
@@ -113,8 +114,9 @@ public interface INetworkMaster {
/**
* @param pattern The {@link ItemStack} to get a pattern for
* @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);
/**
@@ -135,7 +137,8 @@ public interface INetworkMaster {
* @param simulate If we are simulating
* @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.
@@ -145,7 +148,8 @@ public interface INetworkMaster {
* @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
*/
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.
@@ -155,5 +159,5 @@ public interface INetworkMaster {
* @return The {@link ItemStack} we found, do NOT modify
*/
@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
*
* @param world The world
* @param network The network we're trying to connect to
*/

View File

@@ -12,20 +12,34 @@ public class WirelessGridConsumer {
private EnumHand hand;
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) {
this.player = player;
this.hand = hand;
this.wirelessGrid = wirelessGrid;
}
/**
* @return The wireless grid {@link ItemStack}
*/
public ItemStack getWirelessGrid() {
return wirelessGrid;
}
/**
* @return The hand this wireless grid is in
*/
public EnumHand getHand() {
return hand;
}
/**
* @return The player using the wireless grid
*/
public EntityPlayer getPlayer() {
return player;
}

View File

@@ -3,6 +3,7 @@ package refinedstorage.api.storage;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
/**
@@ -26,6 +27,7 @@ public interface IStorage {
* @param simulate If we are simulating
* @return null if the push was successful, or a {@link ItemStack} with the remainder
*/
@Nullable
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}
* @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);
/**

View File

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