Update storage drawers API

This commit is contained in:
Raoul Van den Berge
2016-10-10 23:24:23 +02:00
parent 9c1f813cdb
commit 9ec43fe71b
15 changed files with 43 additions and 30 deletions

View File

@@ -6,7 +6,7 @@ import net.minecraftforge.fml.common.eventhandler.Event;
/**
* This event is called when a drawer has been bound to a new item. This is
* and opportunity for mods to cache extended data with the drawer.
* <p>
*
* This event is also called when the drawer is changed to empty.
*/
public class DrawerPopulatedEvent extends Event {

View File

@@ -15,7 +15,7 @@ public interface IDrawerInventory extends ISidedInventory {
* Gets an IInventory slot index suitable for operations for the given type.
*
* @param drawerSlot The index of the drawer within its group.
* @param type The type of IInventory slot to return an index for.
* @param type The type of IInventory slot to return an index for.
*/
int getInventorySlot(int drawerSlot, SlotType type);

View File

@@ -9,9 +9,7 @@ public enum SlotType {
*/
INPUT,
/**
* An inventory slot for output-only operations; stack sizes artificially held high.
*/
/** An inventory slot for output-only operations; stack sizes artificially held high. */
OUTPUT;
public static final SlotType[] values = values();

View File

@@ -1,4 +1,4 @@
package com.jaquadro.minecraft.storagedrawers.api.pack;/*package com.jaquadro.minecraft.storagedrawers.api.pack;
/*package com.jaquadro.minecraft.storagedrawers.api.pack;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;

View File

@@ -1,4 +1,4 @@
package com.jaquadro.minecraft.storagedrawers.api.pack;/*package com.jaquadro.minecraft.storagedrawers.api.pack;
/*package com.jaquadro.minecraft.storagedrawers.api.pack;
import net.minecraft.block.Block;

View File

@@ -1,4 +1,4 @@
package com.jaquadro.minecraft.storagedrawers.api.pack;/*package com.jaquadro.minecraft.storagedrawers.api.pack;
/*package com.jaquadro.minecraft.storagedrawers.api.pack;
public interface IPackBlock
{

View File

@@ -1,4 +1,4 @@
package com.jaquadro.minecraft.storagedrawers.api.pack;/*package com.jaquadro.minecraft.storagedrawers.api.pack;
/*package com.jaquadro.minecraft.storagedrawers.api.pack;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
@@ -23,11 +23,13 @@ public interface IPackBlockFactory
/**
* Hides block from NEI if NEI is active.
* <p>
* Registers block metadata from an initialized DataResolver with Storage Drawers.
*/
//void hideBlock (String blockID);
/**
* Registers block metadata from an initialized DataResolver with Storage Drawers.
*/
//void registerResolver (IExtendedDataResolver resolver);
*/
//void registerResolver (IExtendedDataResolver resolver);
//}

View File

@@ -13,7 +13,7 @@ public interface IRecipeHandler {
* Get the recipe ingredient list as an array of objects (usually used for shaped recipes).
* If your array does not contain ItemStack objects, you will need to register an {@link IIngredientHandler} to
* get an ItemStack from them.
* <p>
*
* If you would prefer to return a List, return null in this method and implement {@link #getInputAsList}.
*
* @param recipe An instance of a custom {@link IRecipe}.
@@ -25,7 +25,7 @@ public interface IRecipeHandler {
* Get the recipe ingredient list as a list of objects (usually used for shapeless recipes).
* If your list does not contain ItemStack objects, you will need to register an {@link IIngredientHandler} to
* get an ItemStack from them.
* <p>
*
* If you would prefer to return an array, return null in this method and implement {@link #getInputAsArray}.
*
* @param recipe An instance of a custom {@link IRecipe}.

View File

@@ -20,10 +20,21 @@ public interface IDrawer {
* Sets the type of the stored item and initializes it to the given amount. Any existing item will be replaced.
*
* @param itemPrototype An ItemStack representing the type, metadata, and tags of the item to store.
* @param amount The amount to initialize the stored item count to.
* @param amount The amount to initialize the stored item count to.
* @deprecated setStoredItem may redirect its set to another IDrawer, so use setStoredItemRedir instead.
*/
@Deprecated
void setStoredItem(ItemStack itemPrototype, int amount);
/**
* Sets the type of the stored item and initializes it to the given amount. Any existing item will be replaced.
*
* @param itemPrototype An ItemStack representing the type, metadata, and tags of the item to store.
* @param amount The amount to initialize the stored item count to.
* @return The IDrawer actually set with the prototype. Some drawer groups can redirect a set operation to another member.
*/
IDrawer setStoredItemRedir(ItemStack itemPrototype, int amount);
/**
* Gets the number of items stored in this drawer.
*/
@@ -62,7 +73,7 @@ public interface IDrawer {
/**
* Gets whether or not an item of the given type and data can be stored in this drawer.
* <p>
*
* Stack size and available capacity are not considered. For drawers that are not empty, this
* method can allow ore-dictionary compatible items to be accepted into the drawer, as defined by what
* the drawer considers to be an equivalent item.
@@ -74,7 +85,7 @@ public interface IDrawer {
/**
* Gets whether or not an item of the given type and data can be extracted from this drawer.
* <p>
*
* This is intended to allow outbound ore-dictionary conversions of compatible items, as defined by what
* the drawer considers to be an equivalent item.
*
@@ -98,8 +109,7 @@ public interface IDrawer {
/**
* Stores auxiliary data with this drawer, mainly for use in integration.
*
* @param key The key to identify the data with.
* @param key The key to identify the data with.
* @param data The data to store.
*/
void setExtendedData(String key, Object data);

View File

@@ -7,7 +7,7 @@ package com.jaquadro.minecraft.storagedrawers.api.storage;
public interface IFractionalDrawer extends IDrawer {
/**
* Gets the storage ratio between the held item and the most compressed item within the drawer group.
* <p>
*
* For example, most ingots have a conversion rate of 9 compared to metal blocks, and nuggets a rate of 81.
* Actual conversion rates are implementation-defined.
*/

View File

@@ -1,20 +1,20 @@
package com.jaquadro.minecraft.storagedrawers.api.storage.attribute;
public interface ILockable {
public interface IItemLockable {
/**
* Gets whether or not a drawer or group is locked for the given lock attribute.
*/
boolean isLocked(LockAttribute attr);
boolean isItemLocked(LockAttribute attr);
/**
* Gets whether or not the lock state can be changed for the given lock attribute.
* If this method returns false, isLocked may still return true.
* If this method returns false, isItemLocked may still return true.
*/
boolean canLock(LockAttribute attr);
boolean canItemLock(LockAttribute attr);
/**
* Sets the lock state of a drawer or group for the given lock attribute.
* If canLock returns false, this is a no-op.
* If canItemLock returns false, this is a no-op.
*/
void setLocked(LockAttribute attr, boolean isLocked);
void setItemLocked(LockAttribute attr, boolean isLocked);
}

View File

@@ -1,6 +1,7 @@
package com.jaquadro.minecraft.storagedrawers.api.storage.attribute;
import com.jaquadro.minecraft.storagedrawers.api.security.ISecurityProvider;
import net.minecraft.world.ILockableContainer;
import java.util.UUID;
@@ -12,21 +13,24 @@ public interface IProtectable {
/**
* Sets the owner of the drawer. Set to null to set no owner.
*
* @return false if the operation is not supported, true otherwise.
*/
boolean setOwner(UUID owner);
/**
* Gets the provider managing security for the target.
*
* @return null to use the default provider, which enforces strict owner access.
*/
ISecurityProvider getSecurityProvider();
/**
* Gets the lockable interface if it exists on the protected drawer.
* @return A lockable interface, or null if lockable is not supported.
*/
ILockableContainer getLockableContainer();
/**
* Sets the provider managing security for the target. Set to null for default provider.
*
* @return false if the operation is not supported, true otherwise.
*/
boolean setSecurityProvider(ISecurityProvider provder);

View File

@@ -9,7 +9,6 @@ public interface ISealable {
/**
* Sets whether or not the drawer is currently sealed.
*
* @return false if the operation is not supported, true otherwise.
*/
boolean setIsSealed(boolean state);

View File

@@ -9,7 +9,6 @@ public interface IShroudable {
/**
* Sets whether or not the drawer is currently shrouded.
*
* @return false if the operation is not supported, true otherwise.
*/
boolean setIsShrouded(boolean state);