Improve docs
This commit is contained in:
@@ -10,13 +10,13 @@ import javax.annotation.Nonnull;
|
||||
*/
|
||||
public interface IAPI {
|
||||
/**
|
||||
* @return The solderer registry
|
||||
* @return the solderer registry
|
||||
*/
|
||||
@Nonnull
|
||||
ISoldererRegistry getSoldererRegistry();
|
||||
|
||||
/**
|
||||
* @return The crafting task registry
|
||||
* @return the crafting task registry
|
||||
*/
|
||||
@Nonnull
|
||||
ICraftingTaskRegistry getCraftingTaskRegistry();
|
||||
|
||||
@@ -20,7 +20,7 @@ public final class RefinedStorageAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The Refined Storage API
|
||||
* @return the Refined Storage API
|
||||
*/
|
||||
public static IAPI instance() {
|
||||
return API;
|
||||
|
||||
@@ -9,38 +9,40 @@ import java.util.List;
|
||||
*/
|
||||
public interface ICraftingPattern {
|
||||
/**
|
||||
* @return The container where the pattern is in
|
||||
* @return the {@link ICraftingPatternContainer} where the pattern is in
|
||||
*/
|
||||
ICraftingPatternContainer getContainer();
|
||||
|
||||
/**
|
||||
* @return The crafting pattern stack
|
||||
* @return the crafting pattern stack
|
||||
*/
|
||||
ItemStack getStack();
|
||||
|
||||
/**
|
||||
* @return Whether the crafting pattern is valid
|
||||
* @return true if the crafting pattern is valid, false otherwise
|
||||
*/
|
||||
boolean isValid();
|
||||
|
||||
/**
|
||||
* @return The inputs
|
||||
* @return the inputs
|
||||
*/
|
||||
List<ItemStack> getInputs();
|
||||
|
||||
/**
|
||||
* @return The outputs
|
||||
* @return the outputs
|
||||
*/
|
||||
List<ItemStack> getOutputs();
|
||||
|
||||
/**
|
||||
* @return The id of the crafting task, as defined in the registry
|
||||
* @return the id of the factory that creates a crafting task for this pattern, as defined in the registry
|
||||
*/
|
||||
String getId();
|
||||
|
||||
/**
|
||||
* @param requested The item requested
|
||||
* @return The quantity returned per request
|
||||
* Returns the quantity of items that this crafting task yields per request.
|
||||
*
|
||||
* @param requested the item requested
|
||||
* @return the quantity
|
||||
*/
|
||||
int getQuantityPerRequest(ItemStack requested);
|
||||
}
|
||||
|
||||
@@ -4,28 +4,28 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
/**
|
||||
* Represents the container where the pattern is in.
|
||||
* Represents the container where a crafting pattern is in.
|
||||
*/
|
||||
public interface ICraftingPatternContainer {
|
||||
/**
|
||||
* This usually corresponds to the amount of speed upgrades in a crafter.
|
||||
* The speed that crafting tasks that have a pattern in this container can run.
|
||||
*
|
||||
* @return The speed of this container
|
||||
* @return the speed of this container
|
||||
*/
|
||||
int getSpeed();
|
||||
|
||||
/**
|
||||
* @return The {@link IItemHandler} that this container is facing
|
||||
* @return the {@link IItemHandler} that this container is facing
|
||||
*/
|
||||
IItemHandler getConnectedItems();
|
||||
|
||||
/**
|
||||
* @return The patterns stored in this container
|
||||
* @return the patterns stored in this container
|
||||
*/
|
||||
IItemHandler getPatterns();
|
||||
|
||||
/**
|
||||
* @return The position of this container
|
||||
* @return the position of this container
|
||||
*/
|
||||
BlockPos getPosition();
|
||||
}
|
||||
|
||||
@@ -6,17 +6,17 @@ import net.minecraft.world.World;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Implement this interface on pattern items.
|
||||
* When you implement this interface on your patterns, they will be insertable in crafters.
|
||||
* Implement this interface on crafting pattern items.
|
||||
* When this interface is implemented on the item in question, they will be insertable in crafters.
|
||||
*/
|
||||
public interface ICraftingPatternProvider {
|
||||
/**
|
||||
* Creates a crafting pattern.
|
||||
*
|
||||
* @param world The world
|
||||
* @param stack The pattern stack
|
||||
* @param container The container where the pattern is in
|
||||
* @return The crafting pattern
|
||||
* @param world the world
|
||||
* @param stack the pattern stack
|
||||
* @param container the {@link ICraftingPatternContainer} where the pattern is in
|
||||
* @return the crafting pattern
|
||||
*/
|
||||
@Nonnull
|
||||
ICraftingPattern create(World world, ItemStack stack, ICraftingPatternContainer container);
|
||||
|
||||
@@ -9,17 +9,17 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A factory that creates a crafting task from a NBT tag and crafting pattern.
|
||||
* Register this factory to create your own custom crafting tasks.
|
||||
* A factory that creates a crafting task.
|
||||
* Register this factory in the {@link ICraftingTaskRegistry}.
|
||||
*/
|
||||
public interface ICraftingTaskFactory {
|
||||
/**
|
||||
* Returns a crafting task for a given NBT tag and pattern.
|
||||
*
|
||||
* @param world The world
|
||||
* @param tag The NBT tag. If this is null it isn't reading from disk but is used for making a task on demand
|
||||
* @param pattern The pattern
|
||||
* @return The crafting task
|
||||
* @param world the world
|
||||
* @param tag the NBT tag, if this is null it isn't reading from disk but is used for making a task on demand
|
||||
* @param pattern the pattern
|
||||
* @return the crafting task
|
||||
*/
|
||||
@Nonnull
|
||||
ICraftingTask create(World world, @Nullable NBTTagCompound tag, ICraftingPattern pattern);
|
||||
|
||||
@@ -3,23 +3,23 @@ package refinedstorage.api.autocrafting.registry;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A registry that stores the various crafting task types.
|
||||
* A registry that stores crafting task factories.
|
||||
*/
|
||||
public interface ICraftingTaskRegistry {
|
||||
/**
|
||||
* Adds a crafting task factory to the registry.
|
||||
* The id is used for reading and writing the crafting tasks to disk.
|
||||
* The id is used for identifying tasks when they are read from disk.
|
||||
*
|
||||
* @param id The id of the crafting task type
|
||||
* @param factory The factory
|
||||
* @param id the id of the factory
|
||||
* @param factory the factory
|
||||
*/
|
||||
void addFactory(String id, ICraftingTaskFactory factory);
|
||||
|
||||
/**
|
||||
* Returns the factory of a crafting task type id.
|
||||
* Returns the crafting task factory by factory id.
|
||||
*
|
||||
* @param id The id
|
||||
* @return The factory
|
||||
* @param id the factory id
|
||||
* @return the factory
|
||||
*/
|
||||
@Nullable
|
||||
ICraftingTaskFactory getFactory(String id);
|
||||
|
||||
@@ -12,51 +12,52 @@ import javax.annotation.Nullable;
|
||||
*/
|
||||
public interface ICraftingTask {
|
||||
/**
|
||||
* @return The pattern
|
||||
* @return the pattern
|
||||
*/
|
||||
ICraftingPattern getPattern();
|
||||
|
||||
/**
|
||||
* @return The child task
|
||||
* @return the child task
|
||||
*/
|
||||
@Nullable
|
||||
ICraftingTask getChild();
|
||||
|
||||
/**
|
||||
* @param child The child task
|
||||
* @param child the child task
|
||||
*/
|
||||
void setChild(@Nullable ICraftingTask child);
|
||||
|
||||
/**
|
||||
* @param world The world
|
||||
* @param network The network
|
||||
* @return If the crafting task is done
|
||||
* @param world the world
|
||||
* @param network the network
|
||||
* @return true if the crafting task is done, false otherwise
|
||||
*/
|
||||
boolean update(World world, INetworkMaster network);
|
||||
|
||||
/**
|
||||
* Gets called when this crafting task is cancelled.
|
||||
* Gets called when the crafting task is cancelled.
|
||||
*
|
||||
* @param network The network
|
||||
* @param network the network
|
||||
*/
|
||||
void onCancelled(INetworkMaster network);
|
||||
|
||||
/**
|
||||
* Writes this crafting task to NBT.
|
||||
*
|
||||
* @param tag The NBT tag to write to
|
||||
* @param tag the NBT tag to write to
|
||||
* @return the written NBT tag
|
||||
*/
|
||||
NBTTagCompound writeToNBT(NBTTagCompound tag);
|
||||
|
||||
/**
|
||||
* Returns status info used in the tooltip of the crafting monitor.
|
||||
* Returns the status of this crafting task that is used for the tooltip in the crafting monitor.
|
||||
*
|
||||
* @return The status
|
||||
* @return the status
|
||||
*/
|
||||
String getStatus();
|
||||
|
||||
/**
|
||||
* @return The progress for display in the crafting monitor, -1 for no progress
|
||||
* @return the progress for display in the crafting monitor, or -1 to not display any progress
|
||||
*/
|
||||
int getProgress();
|
||||
}
|
||||
|
||||
@@ -23,81 +23,81 @@ import java.util.List;
|
||||
*/
|
||||
public interface INetworkMaster {
|
||||
/**
|
||||
* @return The energy storage of this network
|
||||
* @return the energy storage of this network
|
||||
*/
|
||||
EnergyStorage getEnergy();
|
||||
|
||||
/**
|
||||
* @return The energy usage per tick of this network
|
||||
* @return the energy usage per tick of this network
|
||||
*/
|
||||
int getEnergyUsage();
|
||||
|
||||
/**
|
||||
* @return The position of this network in the world
|
||||
* @return the position of this network in the world
|
||||
*/
|
||||
BlockPos getPosition();
|
||||
|
||||
/**
|
||||
* @return If this network is able to run (usually corresponds to the redstone setting)
|
||||
* @return if this network is able to run (usually corresponds to the redstone configuration)
|
||||
*/
|
||||
boolean canRun();
|
||||
|
||||
/**
|
||||
* @return A graph of connected nodes to this network
|
||||
* @return a graph of connected nodes to this network
|
||||
*/
|
||||
INetworkNodeGraph getNodeGraph();
|
||||
|
||||
/**
|
||||
* @return The {@link IItemGridHandler} for this network
|
||||
* @return the {@link IItemGridHandler} of this network
|
||||
*/
|
||||
IItemGridHandler getItemGridHandler();
|
||||
|
||||
/**
|
||||
* @return The {@link IFluidGridHandler} for this network
|
||||
* @return the {@link IFluidGridHandler} of this network
|
||||
*/
|
||||
IFluidGridHandler getFluidGridHandler();
|
||||
|
||||
/**
|
||||
* @return The {@link IWirelessGridHandler} for this network
|
||||
* @return the {@link IWirelessGridHandler} of this network
|
||||
*/
|
||||
IWirelessGridHandler getWirelessGridHandler();
|
||||
|
||||
/**
|
||||
* @return The {@link IGroupedItemStorage} of this network
|
||||
* @return the {@link IGroupedItemStorage} of this network
|
||||
*/
|
||||
IGroupedItemStorage getItemStorage();
|
||||
|
||||
/**
|
||||
* @return The {@link IGroupedFluidStorage} of this network
|
||||
* @return the {@link IGroupedFluidStorage} of this network
|
||||
*/
|
||||
IGroupedFluidStorage getFluidStorage();
|
||||
|
||||
/**
|
||||
* @return The crafting tasks in this network, do NOT modify this list
|
||||
* @return the crafting tasks in this network, do NOT modify this list
|
||||
*/
|
||||
List<ICraftingTask> getCraftingTasks();
|
||||
|
||||
/**
|
||||
* Adds a crafting task to the top of the crafting task stack.
|
||||
* Adds a crafting task.
|
||||
*
|
||||
* @param task The crafting task to add
|
||||
* @param task the task to add
|
||||
*/
|
||||
void addCraftingTask(@Nonnull ICraftingTask task);
|
||||
|
||||
/**
|
||||
* Cancels a crafting task.
|
||||
*
|
||||
* @param task The task to cancel
|
||||
* @param task the task to cancel
|
||||
*/
|
||||
void cancelCraftingTask(@Nonnull ICraftingTask task);
|
||||
|
||||
/**
|
||||
* Sends a sync packet to all crafting monitors with the crafting task status.
|
||||
* Sends a update packet to all crafting monitors with the crafting task status.
|
||||
*/
|
||||
void updateCraftingTasks();
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
List<ICraftingPattern> getPatterns();
|
||||
|
||||
@@ -109,40 +109,45 @@ public interface INetworkMaster {
|
||||
/**
|
||||
* Returns crafting patterns from an item stack.
|
||||
*
|
||||
* @param pattern The {@link ItemStack} to get a pattern for
|
||||
* @param flags The flags to compare on, see {@link CompareUtils}
|
||||
* @return A list of crafting patterns where the given pattern is one of the outputs
|
||||
* @param pattern the stack to get a pattern for
|
||||
* @param flags the flags to compare on, see {@link CompareUtils}
|
||||
* @return a list of crafting patterns where the given pattern is one of the outputs
|
||||
*/
|
||||
List<ICraftingPattern> getPatterns(ItemStack pattern, int flags);
|
||||
|
||||
/**
|
||||
* @param pattern The {@link ItemStack} to get a pattern for
|
||||
* @param flags The flags to compare on, see {@link CompareUtils}
|
||||
* @return The pattern, or null if the pattern is not found
|
||||
* Returns a crafting pattern for an item stack.
|
||||
* This returns a single crafting pattern, as opposed to {@link INetworkMaster#getPatterns(ItemStack, int)}.
|
||||
* Internally, this makes a selection out of the available patterns.
|
||||
* It makes this selection based on the item count of the pattern outputs in the system.
|
||||
*
|
||||
* @param pattern the stack to get a pattern for
|
||||
* @param flags the flags to compare on, see {@link CompareUtils}
|
||||
* @return the pattern, or null if the pattern is not found
|
||||
*/
|
||||
@Nullable
|
||||
ICraftingPattern getPattern(ItemStack pattern, int flags);
|
||||
|
||||
/**
|
||||
* Sends a grid packet with all the items to all clients that are watching a grid.
|
||||
* Sends a grid update packet with all the items to all clients that are watching a grid connected to this network.
|
||||
*/
|
||||
void sendItemStorageToClient();
|
||||
|
||||
/**
|
||||
* Sends a grid packet with all the items to a specific player.
|
||||
* Sends a grid update packet with all the items to a specific player.
|
||||
*/
|
||||
void sendItemStorageToClient(EntityPlayerMP player);
|
||||
|
||||
/**
|
||||
* Sends a item storage change to all clients that are watching a grid.
|
||||
* Sends a item storage change to all clients that are watching a grid connected to this network.
|
||||
*
|
||||
* @param stack The stack
|
||||
* @param delta The delta
|
||||
* @param stack the stack
|
||||
* @param delta the delta
|
||||
*/
|
||||
void sendItemStorageDeltaToClient(ItemStack stack, int delta);
|
||||
|
||||
/**
|
||||
* Sends a grid packet with all the fluids to all clients that are watching a grid.
|
||||
* Sends a grid update packet with all the fluids to all clients that are watching a grid connected to this network.
|
||||
*/
|
||||
void sendFluidStorageToClient();
|
||||
|
||||
@@ -152,20 +157,20 @@ public interface INetworkMaster {
|
||||
void sendFluidStorageToClient(EntityPlayerMP player);
|
||||
|
||||
/**
|
||||
* Sends a fluids storage change to all clients that are watching a grid.
|
||||
* Sends a fluids storage change to all clients that are watching a grid connected to this network.
|
||||
*
|
||||
* @param stack The stack
|
||||
* @param delta The delta
|
||||
* @param stack the stack
|
||||
* @param delta the delta
|
||||
*/
|
||||
void sendFluidStorageDeltaToClient(FluidStack stack, int delta);
|
||||
|
||||
/**
|
||||
* Inserts an item to this network.
|
||||
* Inserts an item in this network.
|
||||
*
|
||||
* @param stack The stack prototype to insert, do NOT modify
|
||||
* @param size The amount of that prototype that has to be inserted
|
||||
* @param simulate If we are simulating
|
||||
* @return null if the insert was successful, or an {@link ItemStack} with the remainder
|
||||
* @param stack the stack prototype to insert, do NOT modify
|
||||
* @param size the amount of that prototype that has to be inserted
|
||||
* @param simulate if we are simulating
|
||||
* @return null if the insert was successful, or a stack with the remainder
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack insertItem(@Nonnull ItemStack stack, int size, boolean simulate);
|
||||
@@ -173,21 +178,21 @@ public interface INetworkMaster {
|
||||
/**
|
||||
* Extracts an item from this network.
|
||||
*
|
||||
* @param stack The prototype of the stack to extract, do NOT modify
|
||||
* @param size The amount of that prototype that has to be extracted
|
||||
* @param flags The flags to compare on, see {@link CompareUtils}
|
||||
* @return null if we didn't extract anything, or a {@link ItemStack} with the result
|
||||
* @param stack the prototype of the stack to extract, do NOT modify
|
||||
* @param size the amount of that prototype that has to be extracted
|
||||
* @param flags the flags to compare on, see {@link CompareUtils}
|
||||
* @return null if we didn't extract anything, or a stack with the result
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack extractItem(@Nonnull ItemStack stack, int size, int flags);
|
||||
|
||||
/**
|
||||
* Inserts a fluid to this network.
|
||||
* Inserts a fluid in this network.
|
||||
*
|
||||
* @param stack The stack prototype to insert, do NOT modify
|
||||
* @param size The amount of that prototype that has to be inserted
|
||||
* @param simulate If we are simulating
|
||||
* @return null if the insert was successful, or an {@link FluidStack} with the remainder
|
||||
* @param stack the stack prototype to insert, do NOT modify
|
||||
* @param size the amount of that prototype that has to be inserted
|
||||
* @param simulate if we are simulating
|
||||
* @return null if the insert was successful, or a stack with the remainder
|
||||
*/
|
||||
@Nullable
|
||||
FluidStack insertFluid(@Nonnull FluidStack stack, int size, boolean simulate);
|
||||
@@ -195,16 +200,16 @@ public interface INetworkMaster {
|
||||
/**
|
||||
* Extracts a fluid from this network.
|
||||
*
|
||||
* @param stack The prototype of the stack to extract, do NOT modify
|
||||
* @param size The amount of that prototype that has to be extracted
|
||||
* @param flags The flags to compare on, see {@link CompareUtils}
|
||||
* @return null if we didn't extract anything, or a {@link FluidStack} with the result
|
||||
* @param stack the prototype of the stack to extract, do NOT modify
|
||||
* @param size the amount of that prototype that has to be extracted
|
||||
* @param flags the flags to compare on, see {@link CompareUtils}
|
||||
* @return null if we didn't extract anything, or a stack with the result
|
||||
*/
|
||||
@Nullable
|
||||
FluidStack extractFluid(@Nonnull FluidStack stack, int size, int flags);
|
||||
|
||||
/**
|
||||
* @return The world where this node is in
|
||||
* @return the world where this network is in
|
||||
*/
|
||||
World getNetworkWorld();
|
||||
}
|
||||
|
||||
@@ -5,61 +5,56 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Represents a node in the storage network.
|
||||
* Represents a node in the network.
|
||||
*/
|
||||
public interface INetworkNode {
|
||||
/**
|
||||
* Called every tile entity tick.
|
||||
*/
|
||||
void updateNode();
|
||||
|
||||
/**
|
||||
* @return The energy usage of this node
|
||||
* @return the energy usage of this node
|
||||
*/
|
||||
int getEnergyUsage();
|
||||
|
||||
/**
|
||||
* @return The position of this node in the world
|
||||
* @return the position of this node in the world
|
||||
*/
|
||||
BlockPos getPosition();
|
||||
|
||||
/**
|
||||
* Called when this node is connected to a network.
|
||||
*
|
||||
* @param network The network
|
||||
* @param network the network
|
||||
*/
|
||||
void onConnected(INetworkMaster network);
|
||||
|
||||
/**
|
||||
* Called when this node is disconnected from a network.
|
||||
*
|
||||
* @param network The network
|
||||
* @param network the network
|
||||
*/
|
||||
void onDisconnected(INetworkMaster network);
|
||||
|
||||
/**
|
||||
* @return If we are connected
|
||||
* @return true if this is node is connected to a network, or false otherwise
|
||||
*/
|
||||
boolean isConnected();
|
||||
|
||||
/**
|
||||
* @return If {@link INetworkNode#updateNode()} can get called, typically checks for connection status and redstone mode
|
||||
* @return true if this node can be treated as active, typically checks the redstone configuration
|
||||
*/
|
||||
boolean canUpdate();
|
||||
|
||||
/**
|
||||
* @param direction The direction to conduct to
|
||||
* @return Whether this node can conduct a network signal
|
||||
* @param direction the direction to do a conduction check
|
||||
* @return true if this node can conduct a connection to the given direction, false otherwise
|
||||
*/
|
||||
boolean canConduct(EnumFacing direction);
|
||||
|
||||
/**
|
||||
* @return The network
|
||||
* @return the network
|
||||
*/
|
||||
INetworkMaster getNetwork();
|
||||
|
||||
/**
|
||||
* @return The world where this node is in
|
||||
* @return the world where this node is in
|
||||
*/
|
||||
World getNodeWorld();
|
||||
}
|
||||
|
||||
@@ -5,26 +5,26 @@ import net.minecraft.util.math.BlockPos;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A graph of all the nodes connected to a network.
|
||||
* Represents a graph of all the nodes connected to a network.
|
||||
*/
|
||||
public interface INetworkNodeGraph {
|
||||
/**
|
||||
* Rebuilds the node graph.
|
||||
*
|
||||
* @param start The starting position to start looking for nodes
|
||||
* @param notify Whether to notify nodes of a connection change
|
||||
* @param start the starting position to start looking for nodes
|
||||
* @param notify true to notify the nodes of a connection change, false to not notify
|
||||
*/
|
||||
void rebuild(BlockPos start, boolean notify);
|
||||
|
||||
/**
|
||||
* @return A list of all connected nodes
|
||||
* @return a list of all connected nodes
|
||||
*/
|
||||
List<INetworkNode> all();
|
||||
|
||||
/**
|
||||
* Replaces an old network node with a new one.
|
||||
* Replaces an old node with a new one.
|
||||
*
|
||||
* @param node The node
|
||||
* @param node the node to replace
|
||||
*/
|
||||
void replace(INetworkNode node);
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface IWirelessGridConsumer {
|
||||
/**
|
||||
* @return The player using the wireless grid
|
||||
* @return the player using the wireless grid
|
||||
*/
|
||||
EntityPlayer getPlayer();
|
||||
|
||||
/**
|
||||
* @return The wireless grid stack
|
||||
* @return the wireless grid stack
|
||||
*/
|
||||
ItemStack getStack();
|
||||
}
|
||||
|
||||
@@ -18,33 +18,33 @@ public interface IWirelessGridHandler {
|
||||
/**
|
||||
* Called when a player opens a wireless grid.
|
||||
*
|
||||
* @param player The player that opened the wireless grid
|
||||
* @param controllerWorld The world of the controller
|
||||
* @param hand The hand the player opened it with
|
||||
* @return If the opening was successful
|
||||
* @param player the player that opened the wireless grid
|
||||
* @param controllerWorld the world of the controller
|
||||
* @param hand the hand the player opened it with
|
||||
* @return true if the opening was successful, false otherwise
|
||||
*/
|
||||
boolean onOpen(EntityPlayer player, World controllerWorld, EnumHand hand);
|
||||
|
||||
/**
|
||||
* Called when the player closes a wireless grid.
|
||||
*
|
||||
* @param player The player that closed the grid
|
||||
* @param player the player that closed the grid
|
||||
*/
|
||||
void onClose(EntityPlayer player);
|
||||
|
||||
/**
|
||||
* Drains energy from the wireless grid of a player.
|
||||
*
|
||||
* @param player The player to drain energy from
|
||||
* @param energy The amount of energy that has to be drained
|
||||
* @param player the player that is using the wireless grid to drain energy from
|
||||
* @param energy the amount of energy that has to be drained
|
||||
*/
|
||||
void drainEnergy(EntityPlayer player, int energy);
|
||||
|
||||
/**
|
||||
* Returns a {@link IWirelessGridConsumer} for a player.
|
||||
*
|
||||
* @param player The player to get the wireless grid consumer for
|
||||
* @return The {@link IWirelessGridConsumer} that corresponds to a player, or null if the player isn't using a wireless grid
|
||||
* @param player the player to get the wireless grid consumer for
|
||||
* @return the {@link IWirelessGridConsumer} that corresponds to a player, or null if the player isn't using a wireless grid
|
||||
*/
|
||||
@Nullable
|
||||
IWirelessGridConsumer getConsumer(EntityPlayer player);
|
||||
|
||||
@@ -7,12 +7,12 @@ import net.minecraft.util.math.BlockPos;
|
||||
*/
|
||||
public interface IWirelessTransmitter {
|
||||
/**
|
||||
* @return The range in blocks of this transmitter, starting from {@link IWirelessTransmitter#getOrigin()}
|
||||
* @return the range in blocks of this transmitter, starting from {@link IWirelessTransmitter#getOrigin()}
|
||||
*/
|
||||
int getRange();
|
||||
|
||||
/**
|
||||
* @return The position where the wireless signal starts
|
||||
* @return the position where the wireless signal starts
|
||||
*/
|
||||
BlockPos getOrigin();
|
||||
}
|
||||
|
||||
@@ -6,23 +6,23 @@ import net.minecraft.item.ItemStack;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Defines the behavior of item grids.
|
||||
* Defines the behavior of fluid grids.
|
||||
*/
|
||||
public interface IFluidGridHandler {
|
||||
/**
|
||||
* Called when a player tries to extract a fluid from the grid.
|
||||
*
|
||||
* @param hash The hash of the fluid we're trying to extract, see {@link refinedstorage.api.network.NetworkUtils#getFluidStackHashCode(net.minecraftforge.fluids.FluidStack)}
|
||||
* @param shift If we're shift clicking
|
||||
* @param player The player that is attempting the extraction
|
||||
* @param hash the hash of the fluid we're trying to extract, see {@link refinedstorage.api.network.NetworkUtils#getFluidStackHashCode(net.minecraftforge.fluids.FluidStack)}
|
||||
* @param shift if shift click was used
|
||||
* @param player the player that is attempting the extraction
|
||||
*/
|
||||
void onExtract(int hash, boolean shift, EntityPlayerMP player);
|
||||
|
||||
/**
|
||||
* Called when a player tries to insert fluids to the grid.
|
||||
* Called when a player tries to insert fluids in the grid.
|
||||
*
|
||||
* @param container A stack with a container we're trying to insert
|
||||
* @return The remainder, or null if there is no remainder
|
||||
* @param container a stack with a fluid container we're trying to insert
|
||||
* @return the remainder, or null if there is no remainder
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack onInsert(ItemStack container);
|
||||
@@ -30,7 +30,7 @@ public interface IFluidGridHandler {
|
||||
/**
|
||||
* Called when a player is trying to insert a fluid that it is holding in their hand in the GUI.
|
||||
*
|
||||
* @param player The player that is attempting the insert
|
||||
* @param player the player that is attempting the insert
|
||||
*/
|
||||
void onInsertHeldContainer(EntityPlayerMP player);
|
||||
}
|
||||
|
||||
@@ -16,18 +16,18 @@ public interface IItemGridHandler {
|
||||
/**
|
||||
* Called when a player tries to extract an item from the grid.
|
||||
*
|
||||
* @param hash The hash of the item we're trying to extract, see {@link refinedstorage.api.network.NetworkUtils#getItemStackHashCode(ItemStack)}
|
||||
* @param flags How we are extracting
|
||||
* @param player The player that is attempting the extraction
|
||||
* @param hash the hash of the item we're trying to extract, see {@link refinedstorage.api.network.NetworkUtils#getItemStackHashCode(ItemStack)}
|
||||
* @param flags how we are extracting
|
||||
* @param player the player that is attempting the extraction
|
||||
*/
|
||||
void onExtract(int hash, int flags, EntityPlayerMP player);
|
||||
|
||||
/**
|
||||
* Called when a player tries to insert an item to the grid.
|
||||
* Called when a player tries to insert an item in the grid.
|
||||
*
|
||||
* @param player The player that is attempting the insert
|
||||
* @param stack The item we're trying to insert
|
||||
* @return The remainder, or null if there is no remainder
|
||||
* @param player the player that is attempting the insert
|
||||
* @param stack the item we're trying to insert
|
||||
* @return the remainder, or null if there is no remainder
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack onInsert(EntityPlayerMP player, ItemStack stack);
|
||||
@@ -35,24 +35,24 @@ public interface IItemGridHandler {
|
||||
/**
|
||||
* Called when a player is trying to insert an item that it is holding in their hand in the GUI.
|
||||
*
|
||||
* @param player The player that is attempting the insert
|
||||
* @param single If we are only inserting 1 item
|
||||
* @param player the player that is attempting the insert
|
||||
* @param single if we are only inserting a single item
|
||||
*/
|
||||
void onInsertHeldItem(EntityPlayerMP player, boolean single);
|
||||
|
||||
/**
|
||||
* Called when a player requested crafting for an item.
|
||||
*
|
||||
* @param hash The hash of the item we're requesting crafting for, see {@link refinedstorage.api.network.NetworkUtils#getItemStackHashCode(ItemStack)}
|
||||
* @param quantity The amount of that item that has to be crafted
|
||||
* @param hash the hash of the item we're requesting crafting for, see {@link refinedstorage.api.network.NetworkUtils#getItemStackHashCode(ItemStack)}
|
||||
* @param quantity the amount of that item that has to be crafted
|
||||
*/
|
||||
void onCraftingRequested(int hash, int quantity);
|
||||
|
||||
/**
|
||||
* Called when a player wants to cancel a crafting task.
|
||||
*
|
||||
* @param id The task ID, or -1 for all tasks
|
||||
* @param depth The child depth of this task to cancel
|
||||
* @param id the task id, or -1 to cancel all tasks
|
||||
* @param depth the child depth of this task to cancel
|
||||
*/
|
||||
void onCraftingCancelRequested(int id, int depth);
|
||||
}
|
||||
|
||||
@@ -10,20 +10,20 @@ import javax.annotation.Nullable;
|
||||
*/
|
||||
public interface ISoldererRecipe {
|
||||
/**
|
||||
* @param row The row in the solderer that we want the {@link ItemStack} for (between 0 - 2)
|
||||
* @return A {@link ItemStack} for the given row
|
||||
* @param row the row in the solderer that we want the stack for (between 0 - 2)
|
||||
* @return a stack for the given row, or null for no stack
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack getRow(int row);
|
||||
|
||||
/**
|
||||
* @return The {@link ItemStack} that this recipe gives back
|
||||
* @return the stack that this recipe gives back
|
||||
*/
|
||||
@Nonnull
|
||||
ItemStack getResult();
|
||||
|
||||
/**
|
||||
* @return The duration in ticks that this recipe takes to give the result back from {@link ISoldererRecipe#getResult()}
|
||||
* @return the duration in ticks that this recipe takes to give the result back
|
||||
*/
|
||||
int getDuration();
|
||||
}
|
||||
|
||||
@@ -13,19 +13,21 @@ public interface ISoldererRegistry {
|
||||
/**
|
||||
* Adds a recipe to the registry.
|
||||
*
|
||||
* @param recipe The recipe to add
|
||||
* @param recipe the recipe to add
|
||||
*/
|
||||
void addRecipe(@Nonnull ISoldererRecipe recipe);
|
||||
|
||||
/**
|
||||
* @return A list with all the solderer recipes, do NOT modify
|
||||
*/
|
||||
List<ISoldererRecipe> getRecipes();
|
||||
|
||||
/**
|
||||
* @param items An item handler, where slots 0 - 2 are the rows
|
||||
* @return The {@link ISoldererRecipe}, or null if no recipe was found
|
||||
* Returns a solderer recipe from the rows.
|
||||
*
|
||||
* @param row an item handler, where slots 0 - 2 are the rows
|
||||
* @return the {@link ISoldererRecipe}, or null if no recipe was found
|
||||
*/
|
||||
@Nullable
|
||||
ISoldererRecipe getRecipe(@Nonnull IItemHandler items);
|
||||
ISoldererRecipe getRecipe(@Nonnull IItemHandler row);
|
||||
|
||||
/**
|
||||
* @return a list with all the solderer recipes, do NOT modify
|
||||
*/
|
||||
List<ISoldererRecipe> getRecipes();
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ public final class CompareUtils {
|
||||
/**
|
||||
* Compares two stacks by NBT, damage and quantity.
|
||||
*
|
||||
* @param left The left stack
|
||||
* @param right The right stack
|
||||
* @return Whether the left and right stack are equal
|
||||
* @param left the left stack
|
||||
* @param right the right stack
|
||||
* @return true if the left and right stack are the same, false otherwise
|
||||
*/
|
||||
public static boolean compareStack(ItemStack left, ItemStack right) {
|
||||
return compareStack(left, right, COMPARE_NBT | COMPARE_DAMAGE | COMPARE_QUANTITY);
|
||||
@@ -27,9 +27,9 @@ public final class CompareUtils {
|
||||
/**
|
||||
* Compares two stacks by NBT and damage.
|
||||
*
|
||||
* @param left The left stack
|
||||
* @param right The right stack
|
||||
* @return Whether the left and right stack are equal
|
||||
* @param left the left stack
|
||||
* @param right the right stack
|
||||
* @return true if the left and right stack are the same, false otherwise
|
||||
*/
|
||||
public static boolean compareStackNoQuantity(ItemStack left, ItemStack right) {
|
||||
return compareStack(left, right, COMPARE_NBT | COMPARE_DAMAGE);
|
||||
@@ -38,10 +38,10 @@ public final class CompareUtils {
|
||||
/**
|
||||
* Compares two stacks by the given flags.
|
||||
*
|
||||
* @param left The left stack
|
||||
* @param right The right stack
|
||||
* @param flags The flags to compare with
|
||||
* @return Whether the left and right stack are equal
|
||||
* @param left the left stack
|
||||
* @param right the right stack
|
||||
* @param flags the flags to compare with
|
||||
* @return true if the left and right stack are the same, false otherwise
|
||||
*/
|
||||
public static boolean compareStack(ItemStack left, ItemStack right, int flags) {
|
||||
if (left == null && right == null) {
|
||||
@@ -80,10 +80,10 @@ public final class CompareUtils {
|
||||
/**
|
||||
* Compares two stacks by the given flags.
|
||||
*
|
||||
* @param left The left stack
|
||||
* @param right The right stack
|
||||
* @param flags The flags to compare with
|
||||
* @return Whether the left and right stack are equal
|
||||
* @param left the left stack
|
||||
* @param right the right stack
|
||||
* @param flags the flags to compare with
|
||||
* @return true if the left and right stack are the same, false otherwise
|
||||
*/
|
||||
public static boolean compareStack(FluidStack left, FluidStack right, int flags) {
|
||||
if (left == null && right == null) {
|
||||
@@ -116,9 +116,9 @@ public final class CompareUtils {
|
||||
/**
|
||||
* Compares the NBT tags of two stacks.
|
||||
*
|
||||
* @param left The left stack
|
||||
* @param right The right stack
|
||||
* @return Whether the NBT tags are equal
|
||||
* @param left the left stack
|
||||
* @param right the right stack
|
||||
* @return true if the NBT tags of the two stacks are the same, false otherwise
|
||||
*/
|
||||
public static boolean compareNbt(ItemStack left, ItemStack right) {
|
||||
if (!ItemStack.areItemStackTagsEqual(left, right)) {
|
||||
@@ -137,9 +137,9 @@ public final class CompareUtils {
|
||||
/**
|
||||
* Compares two stacks and checks if they share the same ore dictionary entry.
|
||||
*
|
||||
* @param left The left stack
|
||||
* @param right The right stack
|
||||
* @return Whether the stacks share the same ore dictionary entry
|
||||
* @param left the left stack
|
||||
* @param right the right stack
|
||||
* @return true if the two stacks share the same ore dictionary entry
|
||||
*/
|
||||
public static boolean compareStackOreDict(ItemStack left, ItemStack right) {
|
||||
if (left == null && right == null) {
|
||||
|
||||
@@ -2,7 +2,6 @@ package refinedstorage.api.storage.fluid;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.storage.item.IItemStorageProvider;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -10,21 +9,21 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a fluid storage sink for the storage network.
|
||||
* Provide this through an {@link IItemStorageProvider}.
|
||||
* Provide this through an {@link IFluidStorageProvider}.
|
||||
*/
|
||||
public interface IFluidStorage {
|
||||
/**
|
||||
* @return Fluids stored in this storage
|
||||
* @return fluids stored in this storage
|
||||
*/
|
||||
List<FluidStack> getStacks();
|
||||
|
||||
/**
|
||||
* Inserts a fluid to this storage.
|
||||
* Inserts a fluid in this storage.
|
||||
*
|
||||
* @param stack The fluid prototype to insert, do NOT modify
|
||||
* @param size The amount of that prototype that has to be inserted
|
||||
* @param simulate If we are simulating
|
||||
* @return null if the insert was successful, or a {@link FluidStack} with the remainder
|
||||
* @param stack the fluid prototype to insert, do NOT modify
|
||||
* @param size the amount of that prototype that has to be inserted
|
||||
* @param simulate if we are simulating
|
||||
* @return null if the insert was successful, or a stack with the remainder
|
||||
*/
|
||||
@Nullable
|
||||
FluidStack insertFluid(@Nonnull FluidStack stack, int size, boolean simulate);
|
||||
@@ -34,21 +33,21 @@ public interface IFluidStorage {
|
||||
* <p>
|
||||
* If the fluid we found in the system is smaller than the requested size, return that fluid anyway.
|
||||
*
|
||||
* @param stack A prototype of the fluid to extract, do NOT modify
|
||||
* @param size The amount of that fluid that has to be extracted
|
||||
* @param flags On what we are comparing to extract this fluid, see {@link CompareUtils}
|
||||
* @return null if we didn't extract anything, or an {@link FluidStack} with the result
|
||||
* @param stack a prototype of the fluid to extract, do NOT modify
|
||||
* @param size the amount of that fluid that has to be extracted
|
||||
* @param flags the flags to compare on, see {@link CompareUtils}
|
||||
* @return null if we didn't extract anything, or a stack with the result
|
||||
*/
|
||||
@Nullable
|
||||
FluidStack extractFluid(@Nonnull FluidStack stack, int size, int flags);
|
||||
|
||||
/**
|
||||
* @return The amount of fluids stored in this storage
|
||||
* @return the amount of fluids stored in this storage
|
||||
*/
|
||||
int getStored();
|
||||
|
||||
/**
|
||||
* @return The priority of this storage
|
||||
* @return the priority of this storage
|
||||
*/
|
||||
int getPriority();
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ package refinedstorage.api.storage.fluid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a tile that provides item storage to the network. Implement this on a tile that is a {@link refinedstorage.api.network.INetworkNode}.
|
||||
* Represents a node that provides fluid storage to the network.
|
||||
*/
|
||||
public interface IFluidStorageProvider {
|
||||
/**
|
||||
* Adds the fluid storages that this storage provider provides.
|
||||
*
|
||||
* @param storages The previously added fluid storages
|
||||
* @param storages the previously added fluid storages
|
||||
*/
|
||||
void addFluidStorages(List<IFluidStorage> storages);
|
||||
}
|
||||
|
||||
@@ -3,14 +3,13 @@ package refinedstorage.api.storage.fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.storage.item.IItemStorageProvider;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
/**e
|
||||
* This holds all fluids from all the connected storages from a {@link INetworkMaster}.
|
||||
* <p>
|
||||
* Refined Storage uses this class mainly for use in Grids and Detectors to avoid querying
|
||||
@@ -19,7 +18,8 @@ import java.util.List;
|
||||
*/
|
||||
public interface IGroupedFluidStorage {
|
||||
/**
|
||||
* Rebuilds the global fluid list. Typically called when a {@link IItemStorageProvider} is added or removed from the network.
|
||||
* Rebuilds the global fluid list.
|
||||
* Typically called when a {@link IFluidStorageProvider} is added or removed from the network.
|
||||
*/
|
||||
void rebuild();
|
||||
|
||||
@@ -31,8 +31,8 @@ public interface IGroupedFluidStorage {
|
||||
* <p>
|
||||
* Will merge it with another fluid if it already exists.
|
||||
*
|
||||
* @param stack The fluid to add, do NOT modify
|
||||
* @param rebuilding Whether this method is called while the storage is rebuilding
|
||||
* @param stack the stack to add, do NOT modify
|
||||
* @param rebuilding whether this method is called while the storage is rebuilding
|
||||
*/
|
||||
void add(@Nonnull FluidStack stack, boolean rebuilding);
|
||||
|
||||
@@ -42,16 +42,16 @@ public interface IGroupedFluidStorage {
|
||||
* Note that this doesn't modify any of the connected storages, but just modifies the global fluid list.
|
||||
* Use {@link INetworkMaster#extractFluid(FluidStack, int, int)} to remove an fluid from an actual storage.
|
||||
*
|
||||
* @param stack The fluid to remove, do NOT modify
|
||||
* @param stack the fluid to remove, do NOT modify
|
||||
*/
|
||||
void remove(@Nonnull FluidStack stack);
|
||||
|
||||
/**
|
||||
* Gets a fluid from the network.
|
||||
*
|
||||
* @param stack The stack to find
|
||||
* @param flags The flags to compare on, see {@link CompareUtils}
|
||||
* @return Null if no fluid is found, or the {@link FluidStack}, do NOT modify
|
||||
* @param stack the stack to find
|
||||
* @param flags the flags to compare on, see {@link CompareUtils}
|
||||
* @return null if no fluid is found, or the stack, do NOT modify
|
||||
*/
|
||||
@Nullable
|
||||
FluidStack get(@Nonnull FluidStack stack, int flags);
|
||||
@@ -59,18 +59,18 @@ public interface IGroupedFluidStorage {
|
||||
/**
|
||||
* Gets a fluid from the network by hash, see {@link refinedstorage.api.network.NetworkUtils#getFluidStackHashCode(FluidStack)}.
|
||||
*
|
||||
* @return Null if no fluid is found matching the hash, or the {@link FluidStack}, do NOT modify
|
||||
* @return null if no fluid is found matching the hash, or the stack, do NOT modify
|
||||
*/
|
||||
@Nullable
|
||||
FluidStack get(int hash);
|
||||
|
||||
/**
|
||||
* @return All fluids in this storage network
|
||||
* @return all fluids in this storage network
|
||||
*/
|
||||
Collection<FluidStack> getStacks();
|
||||
|
||||
/**
|
||||
* @return The fluid storages connected to this network
|
||||
* @return the fluid storages connected to this network
|
||||
*/
|
||||
List<IFluidStorage> getStorages();
|
||||
}
|
||||
|
||||
@@ -18,7 +18,8 @@ import java.util.List;
|
||||
*/
|
||||
public interface IGroupedItemStorage {
|
||||
/**
|
||||
* Rebuilds the global item list. Typically called when a {@link IItemStorageProvider} is added or removed from the network.
|
||||
* Rebuilds the global item list.
|
||||
* Typically called when a {@link IItemStorageProvider} is added or removed from the network.
|
||||
*/
|
||||
void rebuild();
|
||||
|
||||
@@ -30,8 +31,8 @@ public interface IGroupedItemStorage {
|
||||
* <p>
|
||||
* Will merge it with another item if it already exists.
|
||||
*
|
||||
* @param stack The stack to add, do NOT modify
|
||||
* @param rebuilding Whether this method is called while the storage is rebuilding
|
||||
* @param stack the stack to add, do NOT modify
|
||||
* @param rebuilding whether this method is called while the storage is rebuilding
|
||||
*/
|
||||
void add(@Nonnull ItemStack stack, boolean rebuilding);
|
||||
|
||||
@@ -41,16 +42,16 @@ public interface IGroupedItemStorage {
|
||||
* Note that this doesn't modify any of the connected storages, but just modifies the global item list.
|
||||
* Use {@link INetworkMaster#extractItem(ItemStack, int, int)} to remove an item from an actual storage.
|
||||
*
|
||||
* @param stack The item to remove, do NOT modify
|
||||
* @param stack the item to remove, do NOT modify
|
||||
*/
|
||||
void remove(@Nonnull ItemStack stack);
|
||||
|
||||
/**
|
||||
* Gets an item from the network.
|
||||
*
|
||||
* @param stack The stack to find
|
||||
* @param flags The flags to compare on, see {@link CompareUtils}
|
||||
* @return Null if no item is found, or the {@link ItemStack}, do NOT modify
|
||||
* @param stack the stack to find
|
||||
* @param flags the flags to compare on, see {@link CompareUtils}
|
||||
* @return null if no item is found, or the stack, do NOT modify
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack get(@Nonnull ItemStack stack, int flags);
|
||||
@@ -58,18 +59,18 @@ public interface IGroupedItemStorage {
|
||||
/**
|
||||
* Gets an item from the network by hash, see {@link refinedstorage.api.network.NetworkUtils#getItemStackHashCode(ItemStack)}.
|
||||
*
|
||||
* @return Null if no item is found matching the hash, or the {@link ItemStack}, do NOT modify
|
||||
* @return null if no item is found matching the hash, or the stack, do NOT modify
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack get(int hash);
|
||||
|
||||
/**
|
||||
* @return All items in this storage network
|
||||
* @return all items in this storage network
|
||||
*/
|
||||
Collection<ItemStack> getStacks();
|
||||
|
||||
/**
|
||||
* @return The item storages connected to this network
|
||||
* @return the item storages connected to this network
|
||||
*/
|
||||
List<IItemStorage> getStorages();
|
||||
}
|
||||
|
||||
@@ -13,17 +13,17 @@ import java.util.List;
|
||||
*/
|
||||
public interface IItemStorage {
|
||||
/**
|
||||
* @return Items stored in this storage
|
||||
* @return items stored in this storage
|
||||
*/
|
||||
List<ItemStack> getItems();
|
||||
|
||||
/**
|
||||
* Inserts an item to this storage.
|
||||
*
|
||||
* @param stack The stack prototype to insert, do NOT modify
|
||||
* @param size The amount of that prototype that has to be inserted
|
||||
* @param simulate If we are simulating
|
||||
* @return null if the insert was successful, or a {@link ItemStack} with the remainder
|
||||
* @param stack the stack prototype to insert, do NOT modify
|
||||
* @param size the amount of that prototype that has to be inserted
|
||||
* @param simulate if we are simulating
|
||||
* @return null if the insert was successful, or a stack with the remainder
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack insertItem(@Nonnull ItemStack stack, int size, boolean simulate);
|
||||
@@ -33,10 +33,10 @@ public interface IItemStorage {
|
||||
* <p>
|
||||
* If the stack we found in the system is smaller than the requested size, return that stack anyway.
|
||||
*
|
||||
* @param stack A prototype of the stack to extract, do NOT modify
|
||||
* @param size The amount of that prototype that has to be extracted
|
||||
* @param flags On what we are comparing to extract this item, see {@link CompareUtils}
|
||||
* @return null if we didn't extract anything, or an {@link ItemStack} with the result
|
||||
* @param stack a prototype of the stack to extract, do NOT modify
|
||||
* @param size the amount of that prototype that has to be extracted
|
||||
* @param flags the flags to compare on, see {@link CompareUtils}
|
||||
* @return null if we didn't extract anything, or a stack with the result
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack extractItem(@Nonnull ItemStack stack, int size, int flags);
|
||||
|
||||
@@ -3,13 +3,13 @@ package refinedstorage.api.storage.item;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a tile that provides item storage to the network. Implement this on a tile that is a {@link refinedstorage.api.network.INetworkNode}.
|
||||
* Represents a node that provides item storage to the network.
|
||||
*/
|
||||
public interface IItemStorageProvider {
|
||||
/**
|
||||
* Adds the item storages that this storage provider provides.
|
||||
*
|
||||
* @param storages The previously added item storages
|
||||
* @param storages the previously added item storages
|
||||
*/
|
||||
void addItemStorages(List<IItemStorage> storages);
|
||||
}
|
||||
|
||||
@@ -18,24 +18,19 @@ public class SoldererRegistry implements ISoldererRegistry {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ISoldererRecipe> getRecipes() {
|
||||
return recipes;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ISoldererRecipe getRecipe(@Nonnull IItemHandler items) {
|
||||
public ISoldererRecipe getRecipe(@Nonnull IItemHandler row) {
|
||||
for (ISoldererRecipe recipe : recipes) {
|
||||
boolean found = true;
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (!CompareUtils.compareStackNoQuantity(recipe.getRow(i), items.getStackInSlot(i)) && !CompareUtils.compareStackOreDict(recipe.getRow(i), items.getStackInSlot(i))) {
|
||||
if (!CompareUtils.compareStackNoQuantity(recipe.getRow(i), row.getStackInSlot(i)) && !CompareUtils.compareStackOreDict(recipe.getRow(i), row.getStackInSlot(i))) {
|
||||
found = false;
|
||||
}
|
||||
|
||||
if (items.getStackInSlot(i) != null && recipe.getRow(i) != null) {
|
||||
if (items.getStackInSlot(i).stackSize < recipe.getRow(i).stackSize) {
|
||||
if (row.getStackInSlot(i) != null && recipe.getRow(i) != null) {
|
||||
if (row.getStackInSlot(i).stackSize < recipe.getRow(i).stackSize) {
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
@@ -48,4 +43,9 @@ public class SoldererRegistry implements ISoldererRegistry {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ISoldererRecipe> getRecipes() {
|
||||
return recipes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ public abstract class TileNode extends TileBase implements INetworkNode, IRedsto
|
||||
return isConnected() && canUpdate();
|
||||
}
|
||||
|
||||
public abstract void updateNode();
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
if (!worldObj.isRemote) {
|
||||
|
||||
Reference in New Issue
Block a user