diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/AutoCraftingEvent.java b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/EventAutocraftingComplete.java similarity index 75% rename from src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/AutoCraftingEvent.java rename to src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/EventAutocraftingComplete.java index 9888ed9f0..e41976138 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/AutoCraftingEvent.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/EventAutocraftingComplete.java @@ -7,13 +7,13 @@ import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.items.ItemHandlerHelper; /** - * Event fired upon completion of an auto crafting task + * Event fired upon completion of an auto crafting task. */ -public class AutoCraftingEvent extends Event { +public class EventAutocraftingComplete extends Event { private ItemStack crafted; private INetworkMaster network; - private AutoCraftingEvent(INetworkMaster network, ItemStack crafted) { + private EventAutocraftingComplete(INetworkMaster network, ItemStack crafted) { this.crafted = crafted; this.network = network; } @@ -27,7 +27,7 @@ public class AutoCraftingEvent extends Event { } public static void fire(INetworkMaster network, ItemStack crafted) { - MinecraftForge.EVENT_BUS.post(new AutoCraftingEvent(network, crafted)); + MinecraftForge.EVENT_BUS.post(new EventAutocraftingComplete(network, crafted)); } public static void fire(INetworkMaster network, ItemStack crafted, int quantity) { diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/ICraftingManager.java b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/ICraftingManager.java index bec170e4e..a09d77967 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/ICraftingManager.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/ICraftingManager.java @@ -10,6 +10,9 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.List; +/** + * The crafting manager handles the storing, updating, adding and deleting of crafting tasks in a network. + */ public interface ICraftingManager { /** * @return the crafting tasks in this network, do NOT modify this list @@ -33,10 +36,10 @@ public interface ICraftingManager { /** * Creates a crafting task. * - * @param stack the stack to create a task for - * @param pattern the pattern - * @param quantity the quantity - * @param automated whether this crafting task is created in an automated way + * @param stack the stack to create a task for + * @param pattern the pattern + * @param quantity the quantity + * @param automated whether this crafting task is created in an automated way * @return the crafting task */ ICraftingTask create(@Nullable ItemStack stack, ICraftingPattern pattern, int quantity, boolean automated); @@ -57,7 +60,7 @@ public interface ICraftingManager { * * @param stack the stack * @param toSchedule the amount of tasks to schedule - * @param compare the compare value to find patterns + * @param compare the compare value to find patterns, see {@link IComparer} * @return the crafting task created, or null if no task is created */ @Nullable @@ -198,9 +201,19 @@ public interface ICraftingManager { */ boolean hasPattern(ItemStack stack, int flags); + /** + * Updates the tasks in this manager. + */ void update(); + /** + * @param tag the tag to read from + */ void readFromNBT(NBTTagCompound tag); + /** + * @param tag the tag to write to + * @return the written tag + */ NBTTagCompound writeToNBT(NBTTagCompound tag); } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/ICraftingPattern.java b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/ICraftingPattern.java index 085d26bfe..40e6351be 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/ICraftingPattern.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/ICraftingPattern.java @@ -36,7 +36,7 @@ public interface ICraftingPattern { boolean isOredict(); /** - * @return true if the crafting pattern may block crafting step + * @return true if the crafting pattern may block other crafting tasks that are the same, false otherwise */ boolean isBlocking(); @@ -74,7 +74,7 @@ public interface ICraftingPattern { List getByproducts(); /** - * @return the id of the factory that creates a crafting task for this pattern, as defined in the registry + * @return the id of the factory that creates a crafting task for this pattern, as defined in the {@link com.raoulvdberge.refinedstorage.api.autocrafting.registry.ICraftingTaskRegistry} */ String getId(); @@ -111,7 +111,7 @@ public interface ICraftingPattern { * Used to balance out {@link com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingStep}s over alike {@link ICraftingPattern}s * * @param pattern the {@link ICraftingPattern} to compare against - * @return true if the patterns are alike + * @return true if the patterns are alike, false otherwise */ boolean alike(ICraftingPattern pattern); } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/ICraftingPatternChain.java b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/ICraftingPatternChain.java index 4e267029c..31921de7a 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/ICraftingPatternChain.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/ICraftingPatternChain.java @@ -3,28 +3,28 @@ package com.raoulvdberge.refinedstorage.api.autocrafting; import java.util.Collection; /** - * Represents a chain of {@link ICraftingPattern}s, used to balance crafts over those patterns + * Represents a chain of {@link ICraftingPattern}s, used to balance crafts over those patterns. */ public interface ICraftingPatternChain extends Collection { /** - * Check whether a pattern belongs in the chain + * Check whether a pattern belongs in the chain. * * @param compare the {@link ICraftingPattern} to check - * @return true if the chains {@link #getPrototype()} is {@link ICraftingPattern#alike(ICraftingPattern)} + * @return true if the chains {@link #getPrototype()} is {@link ICraftingPattern#alike(ICraftingPattern)}, false otherwise */ default boolean isValidForChain(ICraftingPattern compare) { return getPrototype() == compare || getPrototype().alike(compare); } /** - * Cycles the list and returns use you the pattern that was used the longest time ago + * Cycles the list and returns use you the pattern that was used the longest time ago. * * @return an {@link ICraftingPattern} */ ICraftingPattern cycle(); /** - * The prototype used for this {@link ICraftingPatternChain} + * The prototype used for this {@link ICraftingPatternChain}. * * @return an {@link ICraftingPattern} that represents all patterns in the chain */ diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/ICraftingPatternContainer.java b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/ICraftingPatternContainer.java index 7af76897e..69f010e81 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/ICraftingPatternContainer.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/ICraftingPatternContainer.java @@ -7,11 +7,11 @@ import net.minecraftforge.items.IItemHandler; import java.util.List; /** - * Represents the container where a crafting pattern is in. + * Represents a network node that contains crafting patterns. */ public interface ICraftingPatternContainer { /** - * @return the amount of speed upgrades in the container. + * @return the amount of speed upgrades in the container */ int getSpeedUpdateCount(); @@ -36,12 +36,12 @@ public interface ICraftingPatternContainer { BlockPos getPosition(); /** - * @return whether this container is blocked + * @return true if this container is blocked, false otherwise */ boolean isBlocked(); /** - * @param blocked whether the container is blocked + * @param blocked whether the container should be blocked */ void setBlocked(boolean blocked); } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/craftingmonitor/ICraftingMonitorElement.java b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/craftingmonitor/ICraftingMonitorElement.java index 257b53897..b57ea43ad 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/craftingmonitor/ICraftingMonitorElement.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/craftingmonitor/ICraftingMonitorElement.java @@ -5,6 +5,8 @@ import io.netty.buffer.ByteBuf; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import javax.annotation.Nullable; + /** * Represents a crafting monitor element. */ @@ -23,7 +25,7 @@ public interface ICraftingMonitorElement { boolean canDrawSelection(); /** - * Returns the position where the corresponding task is in the crafting task list. + * Returns the position of the corresponding task in the crafting task list. * Used for cancelling tasks. * * @return the id, or -1 if no task is associated with this element @@ -40,6 +42,7 @@ public interface ICraftingMonitorElement { /** * @return the tooltip of this element, or null for no tooltip */ + @Nullable default String getTooltip() { return null; } @@ -55,7 +58,7 @@ public interface ICraftingMonitorElement { * Merge an element into the current element. * * @param element the element to merged with the current one - * @return true if merge was successful + * @return true if merge was successful, false otherwise */ boolean merge(ICraftingMonitorElement element); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/craftingmonitor/ICraftingMonitorElementRegistry.java b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/craftingmonitor/ICraftingMonitorElementRegistry.java index 7a30de7e3..0b521902e 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/craftingmonitor/ICraftingMonitorElementRegistry.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/craftingmonitor/ICraftingMonitorElementRegistry.java @@ -6,7 +6,7 @@ import javax.annotation.Nullable; import java.util.function.Function; /** - * This registry holds factories for crafting monitor elements (for deserialization from the network). + * This registry holds factories for crafting monitor elements (for serialization and deserialization over the network). */ public interface ICraftingMonitorElementRegistry { /** diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/preview/ICraftingPreviewElement.java b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/preview/ICraftingPreviewElement.java index 11b2f202f..d9af53fca 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/preview/ICraftingPreviewElement.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/preview/ICraftingPreviewElement.java @@ -40,7 +40,7 @@ public interface ICraftingPreviewElement { boolean hasMissing(); /** - * @param buf byte buf to write to + * @param buf buffer to write to */ void writeToByteBuf(ByteBuf buf); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/preview/ICraftingPreviewElementRegistry.java b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/preview/ICraftingPreviewElementRegistry.java index 67c63ebf9..3f0debe77 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/preview/ICraftingPreviewElementRegistry.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/preview/ICraftingPreviewElementRegistry.java @@ -6,7 +6,7 @@ import javax.annotation.Nullable; import java.util.function.Function; /** - * This registry holds factories for crafting preview elements (for deserialization from the network). + * This registry holds factories for crafting preview elements (for serialization and deserialization over the network). */ public interface ICraftingPreviewElementRegistry { /** diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/registry/ICraftingTaskFactory.java b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/registry/ICraftingTaskFactory.java index 877d89ebc..6af399c80 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/registry/ICraftingTaskFactory.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/registry/ICraftingTaskFactory.java @@ -19,7 +19,7 @@ public interface ICraftingTaskFactory { * Returns a crafting task for a given NBT tag and pattern. * * @param network the network - * @param stack the stack to create task for + * @param stack the stack to create a task for * @param pattern the pattern * @param quantity the quantity * @param automated whether this crafting task is created in an automated way @@ -33,7 +33,7 @@ public interface ICraftingTaskFactory { * Returns a crafting task for a given NBT tag and pattern. * * @param network the network - * @param stack the stack to create task for + * @param stack the stack to create a task for * @param patternChain the pattern chain * @param quantity the quantity * @param automated whether this crafting task is created in an automated way diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/task/ICraftingStep.java b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/task/ICraftingStep.java index c6288c8d6..5da5d3687 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/task/ICraftingStep.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/task/ICraftingStep.java @@ -10,7 +10,7 @@ import java.util.Deque; import java.util.List; /** - * Represents a step in a crafting task that. + * Represents a step in a crafting task. */ public interface ICraftingStep { /** @@ -19,7 +19,7 @@ public interface ICraftingStep { ICraftingPattern getPattern(); /** - * @return the stacks to insert, no null entries + * @return the stacks to insert */ List getToInsert(); @@ -82,8 +82,8 @@ public interface ICraftingStep { int getReceivedOutput(ItemStack stack); /** - * The {@link ItemStack} given to it will be changed and contain the remainder - * The return value will only be true if the stack size is zero + * The {@link ItemStack} given to it will be changed and contain the remainder. + * The return value will only be true if the stack size is zero. * * @param stack the stack that was inserted in the storage system * @return true if this item belonged to the processable item and was fully used, false otherwise diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/task/ICraftingTask.java b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/task/ICraftingTask.java index 842d37d07..f50defeab 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/task/ICraftingTask.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/task/ICraftingTask.java @@ -28,11 +28,6 @@ public interface ICraftingTask { */ void calculate(); - /** - * Called when this task is cancelled. - */ - void onCancelled(); - /** * Updates this task. Gets called every few ticks, depending on the speed of the pattern container. * {@link ICraftingTask#calculate()} must be run before this! @@ -42,6 +37,11 @@ public interface ICraftingTask { */ boolean update(Map usedContainers); + /** + * Called when this task is cancelled. + */ + void onCancelled(); + /** * Reschedule the task. This does a recalculation and restart of the task. */ @@ -94,9 +94,11 @@ public interface ICraftingTask { List getCraftingMonitorElements(); /** - * @return the crafting pattern corresponding to this task + * {@link ICraftingTask#calculate()} must be run before this! + * + * @return get a list of {@link ICraftingPreviewElement}s */ - ICraftingPattern getPattern(); + List getPreviewStacks(); /** * {@link ICraftingTask#calculate()} must be run before this! @@ -106,15 +108,20 @@ public interface ICraftingTask { List getSteps(); /** - * Used to check if the crafting task has recursive elements (eg. block needs 9 ingots, ingots are crafted by a block) + * @return the crafting pattern corresponding to this task + */ + ICraftingPattern getPattern(); + + /** + * Used to check if the crafting task has recursive elements (eg. block needs 9 ingots, ingots are crafted by a block). * {@link ICraftingTask#calculate()} must be run before this! * - * @return true if no recursion was found + * @return true if no recursion was found, false otherwise */ boolean isValid(); /** - * @return whether the task is finished + * @return true if the task is finished, false otherwise */ boolean isFinished(); @@ -124,14 +131,10 @@ public interface ICraftingTask { IStackList getMissing(); /** - * {@link ICraftingTask#calculate()} must be run before this! + * Returns whether the crafting task is created in an automated way. + * For example: through the Crafting Upgrade or the "Trigger task with redstone signal" option in the crafter. * - * @return get a list of {@link ICraftingPreviewElement}s - */ - List getPreviewStacks(); - - /** - * @return whether this crafting task is created in an automated way (through a Crafting Upgrade or the "Trigger task with redstone signal" option in the Crafter) for example + * @return true if this crafting task is created in an automated way, false otherwise */ boolean isAutomated(); } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/network/INetworkMaster.java b/src/main/java/com/raoulvdberge/refinedstorage/api/network/INetworkMaster.java index 98712ea06..68d519df0 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/network/INetworkMaster.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/network/INetworkMaster.java @@ -32,7 +32,7 @@ public interface INetworkMaster { BlockPos getPosition(); /** - * @return if this network is able to run (usually corresponds to the redstone configuration) + * @return true if this network is able to run (usually corresponds to the redstone configuration), false otherwise */ boolean canRun(); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/network/grid/IItemGridHandler.java b/src/main/java/com/raoulvdberge/refinedstorage/api/network/grid/IItemGridHandler.java index 50ce921bd..0f2d3da71 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/network/grid/IItemGridHandler.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/network/grid/IItemGridHandler.java @@ -19,7 +19,7 @@ public interface IItemGridHandler { * * @param player the player that is attempting the extraction * @param hash the hash of the item we're trying to extract, see {@link IRSAPI#getItemStackHashCode(ItemStack)} - * @param flags how we are extracting + * @param flags how we are extracting, see the flags in {@link IItemGridHandler} */ void onExtract(EntityPlayerMP player, int hash, int flags); @@ -46,7 +46,7 @@ public interface IItemGridHandler { * * @param hash the item stack hash * @param quantity the amount of that item that we need a preview for - * @param noPreview whether the preview should show + * @param noPreview true if the crafting preview window shouldn't be shown, false otherwise */ void onCraftingPreviewRequested(EntityPlayerMP player, int hash, int quantity, boolean noPreview); @@ -55,15 +55,15 @@ public interface IItemGridHandler { * * @param player the player that is requesting the crafting * @param stack the {@link ItemStack} to request a craft for - * @param quantity the amount of that item that has to be crafted + * @param quantity the amount of the item that has to be crafted */ void onCraftingRequested(EntityPlayerMP player, ItemStack stack, int quantity); /** * Called when a player wants to cancel a crafting task. * - * @param player the player that requested the cance - * @param id the task id, or -1 to cancel all tasks + * @param player the player that requested the cancel + * @param id the task id, or -1 to cancel all tasks that are in the network currently */ void onCraftingCancelRequested(EntityPlayerMP player, int id); } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/network/item/INetworkItem.java b/src/main/java/com/raoulvdberge/refinedstorage/api/network/item/INetworkItem.java index 43f2c8cf1..3d1d8267c 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/network/item/INetworkItem.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/network/item/INetworkItem.java @@ -6,7 +6,9 @@ import net.minecraft.util.EnumHand; import net.minecraft.world.World; /** - * Represents a network item. + * Represents a network item (an item that is connected to the network somehow). + * You do not implement this on the item itself, use an {@link INetworkItemProvider} for that. + * This is an object used separately from the actual item, since this stores the player that is using it. */ public interface INetworkItem { /** @@ -21,7 +23,7 @@ public interface INetworkItem { * @param player the player * @param controllerWorld the world where the controller is in * @param hand the hand - * @return whether the network item can be opened + * @return true if the network item can be opened, false otherwise */ boolean onOpen(INetworkMaster network, EntityPlayer player, World controllerWorld, EnumHand hand); } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/network/item/INetworkItemHandler.java b/src/main/java/com/raoulvdberge/refinedstorage/api/network/item/INetworkItemHandler.java index a6567520e..299143503 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/network/item/INetworkItemHandler.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/network/item/INetworkItemHandler.java @@ -7,7 +7,8 @@ import net.minecraft.world.World; import javax.annotation.Nullable; /** - * Handles network items. + * This is the handler for network items of a network. + * It stores which player is currently using what network item. */ public interface INetworkItemHandler { /** diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/network/item/INetworkItemProvider.java b/src/main/java/com/raoulvdberge/refinedstorage/api/network/item/INetworkItemProvider.java index 7c87a7b5f..08e0dd3f3 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/network/item/INetworkItemProvider.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/network/item/INetworkItemProvider.java @@ -3,8 +3,10 @@ package com.raoulvdberge.refinedstorage.api.network.item; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import javax.annotation.Nonnull; + /** - * Provider for network items. Implement this on the item. + * Provider for network items, implement this on the item. */ public interface INetworkItemProvider { /** @@ -15,5 +17,6 @@ public interface INetworkItemProvider { * @param stack the stack * @return the network item */ + @Nonnull INetworkItem provide(INetworkItemHandler handler, EntityPlayer player, ItemStack stack); } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/network/node/INetworkNode.java b/src/main/java/com/raoulvdberge/refinedstorage/api/network/node/INetworkNode.java index b2ac64b43..05bdb3634 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/network/node/INetworkNode.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/network/node/INetworkNode.java @@ -1,7 +1,6 @@ package com.raoulvdberge.refinedstorage.api.network.node; import com.raoulvdberge.refinedstorage.api.network.INetworkMaster; -import com.raoulvdberge.refinedstorage.apiimpl.network.node.INetworkNodeHolder; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.BlockPos; @@ -19,7 +18,10 @@ public interface INetworkNode { int getEnergyUsage(); /** - * @return the item of the node + * Returns the stack that is displayed in the controller GUI. + * Can be an empty stack if no stack should be shown. + * + * @return the item stack of this node */ @Nonnull ItemStack getItemStack(); @@ -39,12 +41,14 @@ public interface INetworkNode { void onDisconnected(INetworkMaster network); /** - * @return true if this node can be treated as updatable, typically checks the redstone configuration + * If a node can be updated typically depends on the redstone configuration. + * + * @return true if this node can be treated as updatable, false otherwise */ boolean canUpdate(); /** - * @return the network + * @return the network, or null if this node is not connected to any network */ @Nullable INetworkMaster getNetwork(); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/network/node/INetworkNodeManager.java b/src/main/java/com/raoulvdberge/refinedstorage/api/network/node/INetworkNodeManager.java index 3e01abb98..b0649f77b 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/network/node/INetworkNodeManager.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/network/node/INetworkNodeManager.java @@ -12,7 +12,7 @@ public interface INetworkNodeManager { /** * Gets a network node from the registry at a given position. * - * @param pos the position + * @param pos the position of the node * @return the network node at the given position, or null if no network node was found */ @Nullable @@ -21,15 +21,15 @@ public interface INetworkNodeManager { /** * Removes a node from the registry at a given position. * - * @param pos the position - * @param notifyClient whether to notify the client of the removal + * @param pos the position of the node + * @param notifyClient true to notify the client of the removal, false otherwise */ void removeNode(BlockPos pos, boolean notifyClient); /** * Sets a node in the registry at a given position. * - * @param pos the position + * @param pos the position of the node * @param node the node */ void setNode(BlockPos pos, INetworkNode node); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/network/node/INetworkNodeProxy.java b/src/main/java/com/raoulvdberge/refinedstorage/api/network/node/INetworkNodeProxy.java index a4861dcf7..97b8c3450 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/network/node/INetworkNodeProxy.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/network/node/INetworkNodeProxy.java @@ -5,7 +5,7 @@ import javax.annotation.Nonnull; /** * Makes a network node accessible from a tile entity. Implement this as a capability. * - * @param + * @param the network node */ public interface INetworkNodeProxy { /** diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/network/node/INetworkNodeRegistry.java b/src/main/java/com/raoulvdberge/refinedstorage/api/network/node/INetworkNodeRegistry.java index ccd114997..b1556fad4 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/network/node/INetworkNodeRegistry.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/network/node/INetworkNodeRegistry.java @@ -6,7 +6,7 @@ import javax.annotation.Nullable; import java.util.function.Function; /** - * This registry holds factories for reading network nodes from NBT. + * This registry holds factories for reading and writing network nodes from and to NBT. */ public interface INetworkNodeRegistry { /** diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/network/readerwriter/IReader.java b/src/main/java/com/raoulvdberge/refinedstorage/api/network/readerwriter/IReader.java index 539bd1383..6b99f655b 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/network/readerwriter/IReader.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/network/readerwriter/IReader.java @@ -3,11 +3,11 @@ package com.raoulvdberge.refinedstorage.api.network.readerwriter; import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode; /** - * Represents a reader block in the world. + * Represents a reader network node. */ public interface IReader extends INetworkNode { /** - * @return the redstone strength this reader is receiving + * @return the redstone strength that this reader is receiving */ int getRedstoneStrength(); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/network/readerwriter/IReaderWriterChannel.java b/src/main/java/com/raoulvdberge/refinedstorage/api/network/readerwriter/IReaderWriterChannel.java index 7606e820d..a2bfb1fdc 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/network/readerwriter/IReaderWriterChannel.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/network/readerwriter/IReaderWriterChannel.java @@ -5,7 +5,7 @@ import net.minecraft.nbt.NBTTagCompound; import java.util.List; /** - * Represents a reader writer channel in the RS network. + * Represents a reader writer channel. */ public interface IReaderWriterChannel { /** diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/network/readerwriter/IReaderWriterHandler.java b/src/main/java/com/raoulvdberge/refinedstorage/api/network/readerwriter/IReaderWriterHandler.java index 7531e1394..9965cc870 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/network/readerwriter/IReaderWriterHandler.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/network/readerwriter/IReaderWriterHandler.java @@ -7,7 +7,8 @@ import net.minecraftforge.common.capabilities.Capability; import java.util.List; /** - * Represents a reader writer handler. Can be for example: items, fluids, energy, ... + * Represents a reader writer handler. + * For example: items, fluids, energy, ... */ public interface IReaderWriterHandler { /** @@ -27,7 +28,7 @@ public interface IReaderWriterHandler { /** * @param reader the reader * @param capability the capability - * @return whether we have the given capability for the reader + * @return true if we have the given capability for the reader, false otherwise */ boolean hasCapabilityReader(IReader reader, Capability capability); @@ -41,7 +42,7 @@ public interface IReaderWriterHandler { /** * @param writer the writer * @param capability the capability - * @return whether we have the given capability for the writer + * @return true if we have the given capability for the writer, false otherwise */ boolean hasCapabilityWriter(IWriter writer, Capability capability); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/network/readerwriter/IReaderWriterHandlerRegistry.java b/src/main/java/com/raoulvdberge/refinedstorage/api/network/readerwriter/IReaderWriterHandlerRegistry.java index b8bb30493..86bfcef74 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/network/readerwriter/IReaderWriterHandlerRegistry.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/network/readerwriter/IReaderWriterHandlerRegistry.java @@ -10,7 +10,7 @@ public interface IReaderWriterHandlerRegistry { /** * Adds a factory to the registry. * - * @param id the id of this reader writer handler. Analog to {@link IReaderWriterHandler#getId()} + * @param id the id of this reader writer handler, as specified in {@link IReaderWriterHandler#getId()} * @param factory the factory */ void add(String id, IReaderWriterHandlerFactory factory); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/network/readerwriter/IWriter.java b/src/main/java/com/raoulvdberge/refinedstorage/api/network/readerwriter/IWriter.java index 8577ce2d8..86e61b56d 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/network/readerwriter/IWriter.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/network/readerwriter/IWriter.java @@ -4,16 +4,16 @@ import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode; import net.minecraft.util.EnumFacing; /** - * Represents a writer block in the world. + * Represents a writer network node. */ public interface IWriter extends INetworkNode { /** - * @return the redstone strength this writer block is emitting + * @return the redstone strength that this writer is emitting */ int getRedstoneStrength(); /** - * @param strength the redstone strength to set to be emitted + * @param strength the redstone strength to be emitted */ void setRedstoneStrength(int strength); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/network/security/ISecurityCard.java b/src/main/java/com/raoulvdberge/refinedstorage/api/network/security/ISecurityCard.java index 2e3b98fa3..ee49ac72e 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/network/security/ISecurityCard.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/network/security/ISecurityCard.java @@ -13,7 +13,7 @@ public interface ISecurityCard { /** * @param permission the permission to check for - * @return whether the bound player has the given permission + * @return true if the bound player has the given permission, false otherwise */ boolean hasPermission(Permission permission); } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/network/security/ISecurityCardContainer.java b/src/main/java/com/raoulvdberge/refinedstorage/api/network/security/ISecurityCardContainer.java index a3ebeed9c..d3ca2ee68 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/network/security/ISecurityCardContainer.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/network/security/ISecurityCardContainer.java @@ -3,7 +3,7 @@ package com.raoulvdberge.refinedstorage.api.network.security; import java.util.List; /** - * A tile that contains security cards. + * Represents a network node that contains security cards. */ public interface ISecurityCardContainer { /** diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/network/security/ISecurityManager.java b/src/main/java/com/raoulvdberge/refinedstorage/api/network/security/ISecurityManager.java index b09fb1f71..693eed3c9 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/network/security/ISecurityManager.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/network/security/ISecurityManager.java @@ -9,7 +9,7 @@ public interface ISecurityManager { /** * @param permission the permission to check for * @param player the player to check that permission for - * @return whether the player has the given permission + * @return true if the player has the given permission, false otherwise */ boolean hasPermission(Permission permission, EntityPlayer player); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorage.java b/src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorage.java index c3e31512d..605875fac 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorage.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorage.java @@ -8,7 +8,7 @@ import java.util.Collection; public interface IStorage { /** - * @return stacks stored in this storage + * @return stacks stored in this storage, empty stacks are allowed */ Collection getStacks(); @@ -38,7 +38,7 @@ public interface IStorage { T extract(@Nonnull T stack, int size, int flags, boolean simulate); /** - * @return the amount of fluids stored in this storage + * @return the amount stored in this storage */ int getStored(); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorageCache.java b/src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorageCache.java index 6968ffa02..bb5439122 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorageCache.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorageCache.java @@ -16,7 +16,7 @@ import java.util.List; public interface IStorageCache { /** * Invalidates the cache. - * Should also call {@link IStorageCache#sort()} to sort the storages correctly. + * Will also call {@link IStorageCache#sort()} to sort the storages correctly. * Typically called when a {@link IStorageProvider} is added or removed from the network. */ void invalidate(); @@ -47,8 +47,8 @@ public interface IStorageCache { void remove(@Nonnull T stack, int size); /** - * Resorts the storages in this cache according to their priority. This needs to be called when the priority - * of a storage changes. + * Resorts the storages in this cache according to their priority. + * This needs to be called when the priority of a storage changes. */ void sort(); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorageDisk.java b/src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorageDisk.java index f85f19df3..c458b1e69 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorageDisk.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorageDisk.java @@ -7,7 +7,7 @@ import java.util.function.Supplier; /** * Represents a storage disk. * - * @param + * @param the storage */ public interface IStorageDisk extends IStorage { /** @@ -20,7 +20,7 @@ public interface IStorageDisk extends IStorage { * Determines if it can be inserted in a disk drive. * * @param stack the disk - * @return whether it's valid + * @return true if the disk is valid, false otherwise */ boolean isValid(ItemStack stack); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorageDiskProvider.java b/src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorageDiskProvider.java index 43f54e27b..2002bb8d6 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorageDiskProvider.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorageDiskProvider.java @@ -5,9 +5,13 @@ import net.minecraft.item.ItemStack; import javax.annotation.Nonnull; /** - * Implement this on an item. + * Implement this on an item that provides storage. */ public interface IStorageDiskProvider { + /** + * @param disk the disk + * @return the storage that this disk provides + */ @Nonnull IStorageDisk create(ItemStack disk); } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorageProvider.java b/src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorageProvider.java index b313a7498..b5557f38e 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorageProvider.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/storage/IStorageProvider.java @@ -6,7 +6,7 @@ import net.minecraftforge.fluids.FluidStack; import java.util.List; /** - * Provides a storage to the network. Implement this on {@link com.raoulvdberge.refinedstorage.api.network.node.INetworkNode}s. + * Represents a node that provides the network with storage. */ public interface IStorageProvider { /** diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/util/IStackList.java b/src/main/java/com/raoulvdberge/refinedstorage/api/util/IStackList.java index b7947941d..8a0ff700d 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/util/IStackList.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/util/IStackList.java @@ -31,7 +31,7 @@ public interface IStackList { * * @param stack the stack * @param size the size to remove - * @return whether the remove was successful for the full amount + * @return true if the remove was successful for the full amount, false otherwise */ boolean remove(@Nonnull T stack, int size); @@ -39,7 +39,7 @@ public interface IStackList { * Decrements the count of that stack in the list. * * @param stack the stack - * @return whether the remove was successful for the full amount + * @return true if the remove was successful for the full amount, false otherwise */ default boolean remove(@Nonnull T stack) { return remove(stack, getSizeFromStack(stack)); @@ -47,20 +47,20 @@ public interface IStackList { /** * Decrements the count of that stack in the list. - * Keeps track of removed stacks and can be undone by calling {@link #undo()} + * Keeps track of removed stacks and can be undone by calling {@link #undo()}. * * @param stack the stack * @param size the size to remove - * @return whether the remove was successful for the full amount + * @return true if the remove was successful for the full amount, false otherwise */ boolean trackedRemove(@Nonnull T stack, int size); /** * Decrements the count of that stack in the list. - * Keeps track of removed stacks and can be undone by calling {@link #undo()} + * Keeps track of removed stacks and can be undone by calling {@link #undo()}. * * @param stack the stack - * @return whether the remove was successful for the full amount + * @return true if the remove was successful for the full amount, false otherwise */ default boolean trackedRemove(@Nonnull T stack) { return trackedRemove(stack, getSizeFromStack(stack)); @@ -112,7 +112,7 @@ public interface IStackList { void clear(); /** - * Removes all stacks with size zero. + * Removes all empty stacks. */ void clean(); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/autocrafting/CraftingManager.java b/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/autocrafting/CraftingManager.java index 002c4599e..6c48f7042 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/autocrafting/CraftingManager.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/autocrafting/CraftingManager.java @@ -179,7 +179,7 @@ public class CraftingManager implements ICraftingManager { ICraftingTask task = craftingTaskIterator.next(); if (task.update(usedCrafters)) { - AutoCraftingEvent.fire(network, task.getRequested(), task.getQuantity()); + EventAutocraftingComplete.fire(network, task.getRequested(), task.getQuantity()); craftingTaskIterator.remove(); craftingTasksChanged = true; diff --git a/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/autocrafting/craftingmonitor/CraftingMonitorElementError.java b/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/autocrafting/craftingmonitor/CraftingMonitorElementError.java index 3814e29fc..913e09613 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/autocrafting/craftingmonitor/CraftingMonitorElementError.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/autocrafting/craftingmonitor/CraftingMonitorElementError.java @@ -5,13 +5,15 @@ import com.raoulvdberge.refinedstorage.api.render.IElementDrawers; import io.netty.buffer.ByteBuf; import net.minecraftforge.fml.common.network.ByteBufUtils; +import javax.annotation.Nullable; + public class CraftingMonitorElementError implements ICraftingMonitorElement { public static final String ID = "error"; private ICraftingMonitorElement base; private String tooltip; - public CraftingMonitorElementError(ICraftingMonitorElement base, String tooltip) { + public CraftingMonitorElementError(ICraftingMonitorElement base, @Nullable String tooltip) { this.base = base; this.tooltip = tooltip; } @@ -39,6 +41,7 @@ public class CraftingMonitorElementError implements ICraftingMonitorElement { } @Override + @Nullable public String getTooltip() { return tooltip; } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/autocrafting/craftingmonitor/CraftingMonitorElementInfo.java b/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/autocrafting/craftingmonitor/CraftingMonitorElementInfo.java index 80906185c..579430466 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/autocrafting/craftingmonitor/CraftingMonitorElementInfo.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/autocrafting/craftingmonitor/CraftingMonitorElementInfo.java @@ -5,13 +5,15 @@ import com.raoulvdberge.refinedstorage.api.render.IElementDrawers; import io.netty.buffer.ByteBuf; import net.minecraftforge.fml.common.network.ByteBufUtils; +import javax.annotation.Nullable; + public class CraftingMonitorElementInfo implements ICraftingMonitorElement { public static final String ID = "info"; private ICraftingMonitorElement base; private String tooltip; - public CraftingMonitorElementInfo(ICraftingMonitorElement base, String tooltip) { + public CraftingMonitorElementInfo(ICraftingMonitorElement base, @Nullable String tooltip) { this.base = base; this.tooltip = tooltip; } @@ -39,6 +41,7 @@ public class CraftingMonitorElementInfo implements ICraftingMonitorElement { } @Override + @Nullable public String getTooltip() { return tooltip; } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/util/StackListFluid.java b/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/util/StackListFluid.java index fa93f59fc..ebb2cbb72 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/util/StackListFluid.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/util/StackListFluid.java @@ -150,7 +150,7 @@ public class StackListFluid implements IStackList { @Override public IStackList getOredicted() { - throw new IllegalAccessError("Fluid lists have no oredicted version!"); + throw new UnsupportedOperationException("Fluid lists have no oredicted version!"); } @Override diff --git a/src/main/java/com/raoulvdberge/refinedstorage/item/ItemWirelessCraftingMonitor.java b/src/main/java/com/raoulvdberge/refinedstorage/item/ItemWirelessCraftingMonitor.java index e4cc72f7e..802385817 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/item/ItemWirelessCraftingMonitor.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/item/ItemWirelessCraftingMonitor.java @@ -7,6 +7,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import javax.annotation.Nonnull; + public class ItemWirelessCraftingMonitor extends ItemNetworkItem { private static final String NBT_VIEW_AUTOMATED = "ViewAutomated"; @@ -22,6 +24,7 @@ public class ItemWirelessCraftingMonitor extends ItemNetworkItem { } @Override + @Nonnull public INetworkItem provide(INetworkItemHandler handler, EntityPlayer player, ItemStack stack) { return new NetworkItemWirelessCraftingMonitor(handler, player, stack); } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/item/ItemWirelessFluidGrid.java b/src/main/java/com/raoulvdberge/refinedstorage/item/ItemWirelessFluidGrid.java index 9618b2b7f..250699802 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/item/ItemWirelessFluidGrid.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/item/ItemWirelessFluidGrid.java @@ -8,6 +8,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import javax.annotation.Nonnull; + public class ItemWirelessFluidGrid extends ItemNetworkItem { public ItemWirelessFluidGrid() { super("wireless_fluid_grid"); @@ -33,6 +35,7 @@ public class ItemWirelessFluidGrid extends ItemNetworkItem { } @Override + @Nonnull public INetworkItem provide(INetworkItemHandler handler, EntityPlayer player, ItemStack stack) { return new NetworkItemWirelessFluidGrid(handler, player, stack); } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/item/ItemWirelessGrid.java b/src/main/java/com/raoulvdberge/refinedstorage/item/ItemWirelessGrid.java index 15b74b9da..d2ae365dc 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/item/ItemWirelessGrid.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/item/ItemWirelessGrid.java @@ -8,6 +8,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import javax.annotation.Nonnull; + public class ItemWirelessGrid extends ItemNetworkItem { public ItemWirelessGrid() { super("wireless_grid"); @@ -35,6 +37,7 @@ public class ItemWirelessGrid extends ItemNetworkItem { } @Override + @Nonnull public INetworkItem provide(INetworkItemHandler handler, EntityPlayer player, ItemStack stack) { return new NetworkItemWirelessGrid(handler, player, stack); }