Improved API docs and code formatting
This commit is contained in:
@@ -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) {
|
@@ -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);
|
||||
}
|
||||
|
@@ -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<ItemStack> 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);
|
||||
}
|
||||
|
@@ -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<ICraftingPattern> {
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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 {
|
||||
/**
|
||||
|
@@ -40,7 +40,7 @@ public interface ICraftingPreviewElement<T> {
|
||||
boolean hasMissing();
|
||||
|
||||
/**
|
||||
* @param buf byte buf to write to
|
||||
* @param buf buffer to write to
|
||||
*/
|
||||
void writeToByteBuf(ByteBuf buf);
|
||||
|
||||
|
@@ -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 {
|
||||
/**
|
||||
|
@@ -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
|
||||
|
@@ -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<ItemStack> 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
|
||||
|
@@ -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<ICraftingPatternContainer, Integer> 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<ICraftingMonitorElement> 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<ICraftingPreviewElement> getPreviewStacks();
|
||||
|
||||
/**
|
||||
* {@link ICraftingTask#calculate()} must be run before this!
|
||||
@@ -106,15 +108,20 @@ public interface ICraftingTask {
|
||||
List<ICraftingStep> 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<ItemStack> 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<ICraftingPreviewElement> 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();
|
||||
}
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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 {
|
||||
/**
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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();
|
||||
|
@@ -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);
|
||||
|
@@ -5,7 +5,7 @@ import javax.annotation.Nonnull;
|
||||
/**
|
||||
* Makes a network node accessible from a tile entity. Implement this as a capability.
|
||||
*
|
||||
* @param <T>
|
||||
* @param <T> the network node
|
||||
*/
|
||||
public interface INetworkNodeProxy<T extends INetworkNode> {
|
||||
/**
|
||||
|
@@ -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 {
|
||||
/**
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -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 {
|
||||
/**
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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 {
|
||||
/**
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -8,7 +8,7 @@ import java.util.Collection;
|
||||
|
||||
public interface IStorage<T> {
|
||||
/**
|
||||
* @return stacks stored in this storage
|
||||
* @return stacks stored in this storage, empty stacks are allowed
|
||||
*/
|
||||
Collection<T> getStacks();
|
||||
|
||||
@@ -38,7 +38,7 @@ public interface IStorage<T> {
|
||||
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();
|
||||
|
||||
|
@@ -16,7 +16,7 @@ import java.util.List;
|
||||
public interface IStorageCache<T> {
|
||||
/**
|
||||
* 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<T> {
|
||||
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();
|
||||
|
||||
|
@@ -7,7 +7,7 @@ import java.util.function.Supplier;
|
||||
/**
|
||||
* Represents a storage disk.
|
||||
*
|
||||
* @param <T>
|
||||
* @param <T> the storage
|
||||
*/
|
||||
public interface IStorageDisk<T> extends IStorage<T> {
|
||||
/**
|
||||
@@ -20,7 +20,7 @@ public interface IStorageDisk<T> extends IStorage<T> {
|
||||
* 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);
|
||||
|
||||
|
@@ -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<T> {
|
||||
/**
|
||||
* @param disk the disk
|
||||
* @return the storage that this disk provides
|
||||
*/
|
||||
@Nonnull
|
||||
IStorageDisk<T> create(ItemStack disk);
|
||||
}
|
||||
|
@@ -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 {
|
||||
/**
|
||||
|
@@ -31,7 +31,7 @@ public interface IStackList<T> {
|
||||
*
|
||||
* @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<T> {
|
||||
* 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<T> {
|
||||
|
||||
/**
|
||||
* 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<T> {
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* Removes all stacks with size zero.
|
||||
* Removes all empty stacks.
|
||||
*/
|
||||
void clean();
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -150,7 +150,7 @@ public class StackListFluid implements IStackList<FluidStack> {
|
||||
|
||||
@Override
|
||||
public IStackList<FluidStack> getOredicted() {
|
||||
throw new IllegalAccessError("Fluid lists have no oredicted version!");
|
||||
throw new UnsupportedOperationException("Fluid lists have no oredicted version!");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user