Update Storage Drawers API, #1346
This commit is contained in:
		@@ -1,22 +1,10 @@
 | 
				
			|||||||
package com.jaquadro.minecraft.storagedrawers.api;
 | 
					package com.jaquadro.minecraft.storagedrawers.api;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.jaquadro.minecraft.storagedrawers.api.config.IUserConfig;
 | 
					 | 
				
			||||||
import com.jaquadro.minecraft.storagedrawers.api.registry.IRecipeHandlerRegistry;
 | 
					 | 
				
			||||||
import com.jaquadro.minecraft.storagedrawers.api.registry.IRenderRegistry;
 | 
					import com.jaquadro.minecraft.storagedrawers.api.registry.IRenderRegistry;
 | 
				
			||||||
import com.jaquadro.minecraft.storagedrawers.api.registry.IWailaRegistry;
 | 
					import com.jaquadro.minecraft.storagedrawers.api.registry.IWailaRegistry;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public interface IStorageDrawersApi {
 | 
					public interface IStorageDrawersApi {
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Recipe handlers are used to make custom recipes compatible with compacting drawers.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    IRecipeHandlerRegistry recipeHandlerRegistry();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    IRenderRegistry renderRegistry();
 | 
					    IRenderRegistry renderRegistry();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    IWailaRegistry wailaRegistry();
 | 
					    IWailaRegistry wailaRegistry();
 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * User-managed configuration for the Storage Drawers mod.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    IUserConfig userConfig();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,7 @@ package com.jaquadro.minecraft.storagedrawers.api;
 | 
				
			|||||||
public class StorageDrawersApi {
 | 
					public class StorageDrawersApi {
 | 
				
			||||||
    private static IStorageDrawersApi instance;
 | 
					    private static IStorageDrawersApi instance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static final String VERSION = "1.10.2-1.3.0";
 | 
					    public static final String VERSION = "2.0.0";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * API entry point.
 | 
					     * API entry point.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,57 @@
 | 
				
			|||||||
 | 
					package com.jaquadro.minecraft.storagedrawers.api.capabilities;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import net.minecraft.item.ItemStack;
 | 
				
			||||||
 | 
					import net.minecraft.util.NonNullList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.annotation.Nonnull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface IItemRepository {
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Gets a list of all items in the inventory.  The same item may appear multiple times with varying counts.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return A list of zero or more items in the inventory.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Nonnull
 | 
				
			||||||
 | 
					    NonNullList<ItemRecord> getAllItems();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Inserts an ItemStack into the inventory and returns the remainder.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param stack    ItemStack to insert.
 | 
				
			||||||
 | 
					     * @param simulate If true, the insertion is only simulated
 | 
				
			||||||
 | 
					     * @return The remaining ItemStack that was not inserted.  If the entire stack was accepted, returns
 | 
				
			||||||
 | 
					     * ItemStack.EMPTY instead.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Nonnull
 | 
				
			||||||
 | 
					    ItemStack insertItem(@Nonnull ItemStack stack, boolean simulate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Tries to extract the given ItemStack from the inventory.  The returned value will be a matching ItemStack
 | 
				
			||||||
 | 
					     * with a stack size equal to or less than amount, or the empty ItemStack if the item could not be found at all.
 | 
				
			||||||
 | 
					     * The returned stack size may exceed the itemstack's getMaxStackSize() value.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param stack    The item to extract.  The stack size is ignored.
 | 
				
			||||||
 | 
					     * @param amount   Amount to extract (may be greater than the stacks max limit)
 | 
				
			||||||
 | 
					     * @param simulate If true, the extraction is only simulated
 | 
				
			||||||
 | 
					     * @return ItemStack extracted from the inventory, or ItemStack.EMPTY if nothing could be extracted.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Nonnull
 | 
				
			||||||
 | 
					    ItemStack extractItem(@Nonnull ItemStack stack, int amount, boolean simulate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * An item record representing an item and the amount stored.
 | 
				
			||||||
 | 
					     * <p>
 | 
				
			||||||
 | 
					     * The ItemStack held by itemPrototype always reports a stack size of 1.
 | 
				
			||||||
 | 
					     * IT IS IMPORTANT THAT YOU NEVER MODIFY itemPrototype.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    class ItemRecord {
 | 
				
			||||||
 | 
					        @Nonnull
 | 
				
			||||||
 | 
					        public final ItemStack itemPrototype;
 | 
				
			||||||
 | 
					        public final int count;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public ItemRecord(@Nonnull ItemStack itemPrototype, int count) {
 | 
				
			||||||
 | 
					            this.itemPrototype = itemPrototype;
 | 
				
			||||||
 | 
					            this.count = count;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,20 +0,0 @@
 | 
				
			|||||||
package com.jaquadro.minecraft.storagedrawers.api.config;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public interface IAddonConfig {
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Gets whether the user has configured a preference for addon packs to hide their blocks and items from Vanilla
 | 
					 | 
				
			||||||
     * creative tabs.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    boolean showAddonItemsNEI();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Gets whether the user has configured a preference for addon packs to hide their blocks and items from NEI.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    boolean showAddonItemsVanilla();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Gets whether the user has configured a preference for addon packs to provide their blocks and items through
 | 
					 | 
				
			||||||
     * their own vanilla tab.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    boolean addonItemsUseSeparateTab();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,13 +0,0 @@
 | 
				
			|||||||
package com.jaquadro.minecraft.storagedrawers.api.config;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.jaquadro.minecraft.storagedrawers.api.pack.BlockConfiguration;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public interface IBlockConfig {
 | 
					 | 
				
			||||||
    String getBlockConfigName(BlockConfiguration blockConfig);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    boolean isBlockEnabled(String blockConfigName);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    int getBlockRecipeOutput(String blockConfigName);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    int getBaseCapacity(String blockConfigName);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,5 +0,0 @@
 | 
				
			|||||||
package com.jaquadro.minecraft.storagedrawers.api.config;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public interface IIntegrationConfig {
 | 
					 | 
				
			||||||
    boolean isRefinedRelocationEnabled();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,17 +0,0 @@
 | 
				
			|||||||
package com.jaquadro.minecraft.storagedrawers.api.config;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * The main hub for user-managed mod configuration.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
public interface IUserConfig {
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Configuration options related to third party addon packs for Storage Drawers.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    @Deprecated
 | 
					 | 
				
			||||||
    IAddonConfig addonConfig();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Configuration options related to individual blocks.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    IBlockConfig blockConfig();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,5 +0,0 @@
 | 
				
			|||||||
@API(owner = "StorageDrawersAPI", provides = "StorageDrawersAPI|config", apiVersion = StorageDrawersApi.VERSION)
 | 
					 | 
				
			||||||
package com.jaquadro.minecraft.storagedrawers.api.config;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.jaquadro.minecraft.storagedrawers.api.StorageDrawersApi;
 | 
					 | 
				
			||||||
import net.minecraftforge.fml.common.API;
 | 
					 | 
				
			||||||
@@ -1,41 +0,0 @@
 | 
				
			|||||||
package com.jaquadro.minecraft.storagedrawers.api.pack;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.jaquadro.minecraft.storagedrawers.api.storage.EnumBasicDrawer;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public enum BlockConfiguration {
 | 
					 | 
				
			||||||
    BasicFull1(BlockType.Drawers, EnumBasicDrawer.FULL1),
 | 
					 | 
				
			||||||
    BasicFull2(BlockType.Drawers, EnumBasicDrawer.FULL2),
 | 
					 | 
				
			||||||
    BasicFull4(BlockType.Drawers, EnumBasicDrawer.FULL4),
 | 
					 | 
				
			||||||
    BasicHalf2(BlockType.Drawers, EnumBasicDrawer.HALF2),
 | 
					 | 
				
			||||||
    BasicHalf4(BlockType.Drawers, EnumBasicDrawer.HALF4),
 | 
					 | 
				
			||||||
    Trim(BlockType.Trim, null);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private final BlockType type;
 | 
					 | 
				
			||||||
    private final EnumBasicDrawer drawer;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    BlockConfiguration(BlockType type, EnumBasicDrawer drawer) {
 | 
					 | 
				
			||||||
        this.type = type;
 | 
					 | 
				
			||||||
        this.drawer = drawer;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public BlockType getBlockType() {
 | 
					 | 
				
			||||||
        return type;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public int getDrawerCount() {
 | 
					 | 
				
			||||||
        return (drawer != null) ? drawer.getDrawerCount() : 0;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public boolean isHalfDepth() {
 | 
					 | 
				
			||||||
        return (drawer != null) && drawer.isHalfDepth();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public static BlockConfiguration by(BlockType type, EnumBasicDrawer drawer) {
 | 
					 | 
				
			||||||
        for (BlockConfiguration config : values()) {
 | 
					 | 
				
			||||||
            if (config.type == type && config.drawer == drawer)
 | 
					 | 
				
			||||||
                return config;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return null;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,6 +0,0 @@
 | 
				
			|||||||
package com.jaquadro.minecraft.storagedrawers.api.pack;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public enum BlockType {
 | 
					 | 
				
			||||||
    Drawers,
 | 
					 | 
				
			||||||
    Trim
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,12 +0,0 @@
 | 
				
			|||||||
package com.jaquadro.minecraft.storagedrawers.api.pack;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public enum TextureType {
 | 
					 | 
				
			||||||
    Front1,
 | 
					 | 
				
			||||||
    Front2,
 | 
					 | 
				
			||||||
    Front4,
 | 
					 | 
				
			||||||
    Side,
 | 
					 | 
				
			||||||
    SideVSplit,
 | 
					 | 
				
			||||||
    SideHSplit,
 | 
					 | 
				
			||||||
    TrimBorder,
 | 
					 | 
				
			||||||
    TrimBlock
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,5 +0,0 @@
 | 
				
			|||||||
@API(owner = "StorageDrawersAPI", provides = "StorageDrawersAPI|pack", apiVersion = StorageDrawersApi.VERSION)
 | 
					 | 
				
			||||||
package com.jaquadro.minecraft.storagedrawers.api.pack;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.jaquadro.minecraft.storagedrawers.api.StorageDrawersApi;
 | 
					 | 
				
			||||||
import net.minecraftforge.fml.common.API;
 | 
					 | 
				
			||||||
@@ -1,21 +0,0 @@
 | 
				
			|||||||
package com.jaquadro.minecraft.storagedrawers.api.registry;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import net.minecraft.item.ItemStack;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import javax.annotation.Nonnull;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Ingredient handlers are used to get ItemStacks from ingredients in custom IRecipe implementations.  If you have
 | 
					 | 
				
			||||||
 * registered an IRecipeHandler that returns lists of objects that aren't ItemStacks, then you will need to
 | 
					 | 
				
			||||||
 * implement an ingredient handler for those objects.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
public interface IIngredientHandler {
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Gets an ItemStack from an object that represents an ingredient in an IRecipe.
 | 
					 | 
				
			||||||
     *
 | 
					 | 
				
			||||||
     * @param object An ingredient object.
 | 
					 | 
				
			||||||
     * @return An ItemStack for the given ingredient.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    @Nonnull
 | 
					 | 
				
			||||||
    ItemStack getItemStack(Object object);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,35 +0,0 @@
 | 
				
			|||||||
package com.jaquadro.minecraft.storagedrawers.api.registry;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import net.minecraft.item.crafting.IRecipe;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Recipe handlers are used by compacting drawers to find more-compressed forms of blocks and items.  If your recipe
 | 
					 | 
				
			||||||
 * to craft compressed items is a custom IRecipe implementation, you will need to register a handler for it.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
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.
 | 
					 | 
				
			||||||
     *
 | 
					 | 
				
			||||||
     * 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}.
 | 
					 | 
				
			||||||
     * @return An array of ItemStacks or objects with a registered {@link IIngredientHandler}.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    Object[] getInputAsArray(IRecipe recipe);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 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.
 | 
					 | 
				
			||||||
     *
 | 
					 | 
				
			||||||
     * 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}.
 | 
					 | 
				
			||||||
     * @return A list of ItemStacks or objects with a registered {@link IIngredientHandler}.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    List getInputAsList(IRecipe recipe);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,11 +0,0 @@
 | 
				
			|||||||
package com.jaquadro.minecraft.storagedrawers.api.registry;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public interface IRecipeHandlerRegistry {
 | 
					 | 
				
			||||||
    void registerRecipeHandler(Class clazz, IRecipeHandler handler);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    void registerIngredientHandler(Class clazz, IIngredientHandler handler);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    IRecipeHandler getRecipeHandler(Class clazz);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    IIngredientHandler getIngredientHandler(Class clazz);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					package com.jaquadro.minecraft.storagedrawers.api.storage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public enum BlockType {
 | 
				
			||||||
 | 
					    Drawers,
 | 
				
			||||||
 | 
					    Trim
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,81 @@
 | 
				
			|||||||
 | 
					package com.jaquadro.minecraft.storagedrawers.api.storage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import net.minecraft.item.ItemStack;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.annotation.Nonnull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class Drawers {
 | 
				
			||||||
 | 
					    public static final IDrawer DISABLED = new DisabledDrawer();
 | 
				
			||||||
 | 
					    public static final IFractionalDrawer DISABLED_FRACTIONAL = new DisabledFractionalDrawer();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static class DisabledDrawer implements IDrawer {
 | 
				
			||||||
 | 
					        @Nonnull
 | 
				
			||||||
 | 
					        @Override
 | 
				
			||||||
 | 
					        public ItemStack getStoredItemPrototype() {
 | 
				
			||||||
 | 
					            return ItemStack.EMPTY;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        @Nonnull
 | 
				
			||||||
 | 
					        @Override
 | 
				
			||||||
 | 
					        public IDrawer setStoredItem(@Nonnull ItemStack itemPrototype) {
 | 
				
			||||||
 | 
					            return this;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        @Override
 | 
				
			||||||
 | 
					        public int getStoredItemCount() {
 | 
				
			||||||
 | 
					            return 0;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        @Override
 | 
				
			||||||
 | 
					        public void setStoredItemCount(int amount) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        @Override
 | 
				
			||||||
 | 
					        public int getMaxCapacity(@Nonnull ItemStack itemPrototype) {
 | 
				
			||||||
 | 
					            return 0;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        @Override
 | 
				
			||||||
 | 
					        public int getRemainingCapacity() {
 | 
				
			||||||
 | 
					            return 0;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        @Override
 | 
				
			||||||
 | 
					        public boolean canItemBeStored(@Nonnull ItemStack itemPrototype) {
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        @Override
 | 
				
			||||||
 | 
					        public boolean canItemBeExtracted(@Nonnull ItemStack itemPrototype) {
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        @Override
 | 
				
			||||||
 | 
					        public boolean isEmpty() {
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        @Override
 | 
				
			||||||
 | 
					        public boolean isEnabled() {
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static class DisabledFractionalDrawer extends DisabledDrawer implements IFractionalDrawer {
 | 
				
			||||||
 | 
					        @Override
 | 
				
			||||||
 | 
					        public int getConversionRate() {
 | 
				
			||||||
 | 
					            return 0;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        @Override
 | 
				
			||||||
 | 
					        public int getStoredItemRemainder() {
 | 
				
			||||||
 | 
					            return 0;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        @Override
 | 
				
			||||||
 | 
					        public boolean isSmallestUnit() {
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					package com.jaquadro.minecraft.storagedrawers.api.storage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class EmptyDrawerAttributes implements IDrawerAttributes {
 | 
				
			||||||
 | 
					    public EmptyDrawerAttributes() {
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,7 +1,6 @@
 | 
				
			|||||||
package com.jaquadro.minecraft.storagedrawers.api.storage;
 | 
					package com.jaquadro.minecraft.storagedrawers.api.storage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import net.minecraft.item.ItemStack;
 | 
					import net.minecraft.item.ItemStack;
 | 
				
			||||||
import net.minecraft.nbt.NBTTagCompound;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.annotation.Nonnull;
 | 
					import javax.annotation.Nonnull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -13,14 +12,28 @@ public interface IDrawer {
 | 
				
			|||||||
    @Nonnull
 | 
					    @Nonnull
 | 
				
			||||||
    ItemStack getStoredItemPrototype();
 | 
					    ItemStack getStoredItemPrototype();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Sets the type of the stored item and initializes it to 0.  Any existing item will be replaced.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param itemPrototype An ItemStack representing the type, metadata, and tags of the item to store.
 | 
				
			||||||
 | 
					     * @return The IDrawer actually set with the prototype.  Some drawer groups can redirect a set operation to another member.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Nonnull
 | 
				
			||||||
 | 
					    IDrawer setStoredItem(@Nonnull ItemStack itemPrototype);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Sets the type of the stored item and initializes it to the given amount.  Any existing item will be replaced.
 | 
					     * 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 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 of items stored in this drawer.
 | 
				
			||||||
     * @return The IDrawer actually set with the prototype.  Some drawer groups can redirect a set operation to another member.
 | 
					     * @return The IDrawer actually set with the prototype.  Some drawer groups can redirect a set operation to another member.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    IDrawer setStoredItem(@Nonnull ItemStack itemPrototype, int amount);
 | 
					    @Nonnull
 | 
				
			||||||
 | 
					    default IDrawer setStoredItem(@Nonnull ItemStack itemPrototype, int amount) {
 | 
				
			||||||
 | 
					        IDrawer drawer = setStoredItem(itemPrototype);
 | 
				
			||||||
 | 
					        drawer.setStoredItemCount(amount);
 | 
				
			||||||
 | 
					        return drawer;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets the number of items stored in this drawer.
 | 
					     * Gets the number of items stored in this drawer.
 | 
				
			||||||
@@ -35,34 +48,68 @@ public interface IDrawer {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    void setStoredItemCount(int amount);
 | 
					    void setStoredItemCount(int amount);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Adds or removes a given amount from the number of items stored in this drawer.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param amount The amount to add (positive) or subtract (negative).
 | 
				
			||||||
 | 
					     * @return 0 if the full adjustment was committed, or a positive value representing the remainder if the full
 | 
				
			||||||
 | 
					     * amount couldn't be added or subtracted.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    default int adjustStoredItemCount(int amount) {
 | 
				
			||||||
 | 
					        if (amount > 0) {
 | 
				
			||||||
 | 
					            int insert = Math.min(amount, getRemainingCapacity());
 | 
				
			||||||
 | 
					            setStoredItemCount(getStoredItemCount() + insert);
 | 
				
			||||||
 | 
					            return amount - insert;
 | 
				
			||||||
 | 
					        } else if (amount < 0) {
 | 
				
			||||||
 | 
					            int stored = getStoredItemCount();
 | 
				
			||||||
 | 
					            int destroy = Math.min(Math.abs(amount), getStoredItemCount());
 | 
				
			||||||
 | 
					            setStoredItemCount(stored - destroy);
 | 
				
			||||||
 | 
					            return amount + destroy;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            return 0;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets the maximum number of items that can be stored in this drawer.
 | 
					     * Gets the maximum number of items that can be stored in this drawer.
 | 
				
			||||||
     * This value will vary depending on the max stack size of the stored item type.
 | 
					     * This value will vary depending on the max stack size of the stored item type.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    int getMaxCapacity();
 | 
					    default int getMaxCapacity() {
 | 
				
			||||||
 | 
					        return getMaxCapacity(getStoredItemPrototype());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets the maximum number of items that could be stored in this drawer if it held the given item.
 | 
					     * Gets the maximum number of items that could be stored in this drawer if it held the given item.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param itemPrototype The item type to query.
 | 
					     * @param itemPrototype The item type to query.  Pass the empty stack to get the max capacity for an empty slot.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    int getMaxCapacity(@Nonnull ItemStack itemPrototype);
 | 
					    int getMaxCapacity(@Nonnull ItemStack itemPrototype);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Gets the maxmimum number of items that could be stored in this drawer for a standard item stack size
 | 
					 | 
				
			||||||
     * of 64.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    int getDefaultMaxCapacity();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets the number of items that could still be added to this drawer before it is full.
 | 
					     * Gets the number of items that could still be added to this drawer before it is full.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    int getRemainingCapacity();
 | 
					    int getRemainingCapacity();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets the max stack size of the item type stored in this drawer.  Convenience method.
 | 
					     * Gets the number of additional items that would be accepted by this drawer.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * Because a drawer may be able to handle items in excess of its full capacity, this value may be larger than
 | 
				
			||||||
 | 
					     * the result of getRemainingCapacity().
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    int getStoredItemStackSize();
 | 
					    default int getAcceptingRemainingCapacity() {
 | 
				
			||||||
 | 
					        return getRemainingCapacity();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Gets the max stack size of the item type stored in this drawer.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    default int getStoredItemStackSize() {
 | 
				
			||||||
 | 
					        @Nonnull ItemStack protoStack = getStoredItemPrototype();
 | 
				
			||||||
 | 
					        if (protoStack.isEmpty())
 | 
				
			||||||
 | 
					            return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return protoStack.getItem().getItemStackLimit(protoStack);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets whether or not an item of the given type and data can be stored in this drawer.
 | 
					     * Gets whether or not an item of the given type and data can be stored in this drawer.
 | 
				
			||||||
@@ -92,27 +139,7 @@ public interface IDrawer {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    boolean isEmpty();
 | 
					    boolean isEmpty();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    default boolean isEnabled() {
 | 
				
			||||||
     * Gets auxiliary data that has been associated with this drawer.
 | 
					        return true;
 | 
				
			||||||
     *
 | 
					    }
 | 
				
			||||||
     * @param key The key used to identify the data.
 | 
					 | 
				
			||||||
     * @return An opaque object that was previously stored.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    Object getExtendedData(String key);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Stores auxiliary data with this drawer, mainly for use in integration.
 | 
					 | 
				
			||||||
     * @param key The key to identify the data with.
 | 
					 | 
				
			||||||
     * @param data The data to store.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    void setExtendedData(String key, Object data);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Called when a component attribute of a drawer (such as lock or void) changes state.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    void attributeChanged();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    void writeToNBT(NBTTagCompound tag);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    void readFromNBT(NBTTagCompound tag);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,63 @@
 | 
				
			|||||||
 | 
					package com.jaquadro.minecraft.storagedrawers.api.storage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.LockAttribute;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface IDrawerAttributes {
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Gets whether or not the lock state can be changed for the given lock attribute.
 | 
				
			||||||
 | 
					     * If this method returns false, isItemLocked may still return true.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    default boolean canItemLock(LockAttribute attr) {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Gets whether or not a drawer or group is locked for the given lock attribute.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    default boolean isItemLocked(LockAttribute attr) {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Gets whether or not the drawer has the concealed attribute.
 | 
				
			||||||
 | 
					     * The shrouded attribute instructs the drawer to not render its item label.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    default boolean isConcealed() {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Gets whether or not the drawer has the sealed attribute.
 | 
				
			||||||
 | 
					     * A sealed drawer cannot be interacted with, and when broken will retain all of its items and upgrades.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    default boolean isSealed() {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Gets whether or not the drawer has the quantified attribute.
 | 
				
			||||||
 | 
					     * The quantified attribute instructs the drawer to render its numerical quantity.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    default boolean isShowingQuantity() {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Gets whether or not the drawer has a voiding attribute.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    default boolean isVoid() {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    default boolean isUnlimitedStorage() {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    default boolean isUnlimitedVending() {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    default boolean isDictConvertible() {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,58 @@
 | 
				
			|||||||
 | 
					package com.jaquadro.minecraft.storagedrawers.api.storage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.LockAttribute;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface IDrawerAttributesModifiable extends IDrawerAttributes {
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Sets whether or not the drawer is currently concealed.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return false if the operation is not supported, true otherwise.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    default boolean setIsConcealed(boolean state) {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Sets the lock state of a drawer or group for the given lock attribute.
 | 
				
			||||||
 | 
					     * If canItemLock returns false, this is a no-op.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return false if the operation is not supported, true otherwise.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    default boolean setItemLocked(LockAttribute attr, boolean isLocked) {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Sets whether or not the drawer is currently quantified.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return false if the operation is not supported, true otherwise.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    default boolean setIsShowingQuantity(boolean state) {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Sets whether or not the drawer is currently sealed.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return false if the operation is not supported, true otherwise.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    default boolean setIsSealed(boolean state) {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    default boolean setIsVoid(boolean state) {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    default boolean setIsUnlimitedStorage(boolean state) {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    default boolean setIsUnlimitedVending(boolean state) {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    default boolean setIsDictConvertible(boolean state) {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,6 +1,13 @@
 | 
				
			|||||||
package com.jaquadro.minecraft.storagedrawers.api.storage;
 | 
					package com.jaquadro.minecraft.storagedrawers.api.storage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public interface IDrawerGroup {
 | 
					import net.minecraft.util.EnumFacing;
 | 
				
			||||||
 | 
					import net.minecraftforge.common.capabilities.Capability;
 | 
				
			||||||
 | 
					import net.minecraftforge.common.capabilities.ICapabilityProvider;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.annotation.Nonnull;
 | 
				
			||||||
 | 
					import javax.annotation.Nullable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface IDrawerGroup extends ICapabilityProvider {
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets the number of drawers contained within this group.
 | 
					     * Gets the number of drawers contained within this group.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
@@ -9,17 +16,23 @@ public interface IDrawerGroup {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets the drawer at the given slot within this group.
 | 
					     * Gets the drawer at the given slot within this group.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
 | 
					    @Nonnull
 | 
				
			||||||
    IDrawer getDrawer(int slot);
 | 
					    IDrawer getDrawer(int slot);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets the drawer at the given slot within this group only if it is enabled.
 | 
					     * Gets the list of available drawer slots in priority order.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    IDrawer getDrawerIfEnabled(int slot);
 | 
					    @Nonnull
 | 
				
			||||||
 | 
					    int[] getAccessibleDrawerSlots();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    @Override
 | 
				
			||||||
     * Gets whether the drawer in the given slot is usable.
 | 
					    default boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
 | 
				
			||||||
     */
 | 
					        return false;
 | 
				
			||||||
    boolean isDrawerEnabled(int slot);
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    boolean markDirtyIfNeeded();
 | 
					    @Nullable
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    default <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
 | 
				
			||||||
 | 
					        return null;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,17 +0,0 @@
 | 
				
			|||||||
package com.jaquadro.minecraft.storagedrawers.api.storage;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import net.minecraft.entity.player.EntityPlayer;
 | 
					 | 
				
			||||||
import net.minecraft.item.ItemStack;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import javax.annotation.Nonnull;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public interface IDrawerGroupInteractive extends IDrawerGroup {
 | 
					 | 
				
			||||||
    @Nonnull
 | 
					 | 
				
			||||||
    ItemStack takeItemsFromSlot(int slot, int count);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    int putItemsIntoSlot(int slot, @Nonnull ItemStack stack, int count);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    int interactPutCurrentItemIntoSlot(int slot, EntityPlayer player);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    int interactPutCurrentInventoryIntoSlot(int slot, EntityPlayer player);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,9 +0,0 @@
 | 
				
			|||||||
package com.jaquadro.minecraft.storagedrawers.api.storage;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public interface IPriorityGroup {
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Gets the list of available drawer slots in priority order.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    int[] getAccessibleDrawerSlots();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,19 +0,0 @@
 | 
				
			|||||||
package com.jaquadro.minecraft.storagedrawers.api.storage;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import net.minecraft.item.ItemStack;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import javax.annotation.Nonnull;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public interface ISmartGroup {
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Gets a lazy enumeration of all slots that will accept at least one item of the given stack, ordered by
 | 
					 | 
				
			||||||
     * insertion preference.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    Iterable<Integer> enumerateDrawersForInsertion(@Nonnull ItemStack stack, boolean strict);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Gets a lazy enumeration of all slots that will provide at least one item of the given stack, ordered by
 | 
					 | 
				
			||||||
     * extraction preference.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    Iterable<Integer> enumerateDrawersForExtraction(@Nonnull ItemStack stack, boolean strict);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,20 +0,0 @@
 | 
				
			|||||||
package com.jaquadro.minecraft.storagedrawers.api.storage.attribute;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public interface IItemLockable {
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Gets whether or not a drawer or group is locked for the given lock attribute.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    boolean isItemLocked(LockAttribute attr);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Gets whether or not the lock state can be changed for the given lock attribute.
 | 
					 | 
				
			||||||
     * If this method returns false, isItemLocked may still return true.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    boolean canItemLock(LockAttribute attr);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Sets the lock state of a drawer or group for the given lock attribute.
 | 
					 | 
				
			||||||
     * If canItemLock returns false, this is a no-op.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    void setItemLocked(LockAttribute attr, boolean isLocked);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,15 +0,0 @@
 | 
				
			|||||||
package com.jaquadro.minecraft.storagedrawers.api.storage.attribute;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public interface IQuantifiable {
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Gets whether or not the drawer has the quantified attribute.
 | 
					 | 
				
			||||||
     * The quantified attribute instructs the drawer to render its numerical quantity.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    boolean isShowingQuantity();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Sets whether or not the drawer is currently quantified.
 | 
					 | 
				
			||||||
     * @return false if the operation is not supported, true otherwise.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    boolean setIsShowingQuantity(boolean state);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,15 +0,0 @@
 | 
				
			|||||||
package com.jaquadro.minecraft.storagedrawers.api.storage.attribute;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public interface IShroudable {
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Gets whether or not the drawer has the shrouded attribute.
 | 
					 | 
				
			||||||
     * The shrouded attribute instructs the drawer to not render its item label.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    boolean isShrouded();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Sets whether or not the drawer is currently shrouded.
 | 
					 | 
				
			||||||
     * @return false if the operation is not supported, true otherwise.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    boolean setIsShrouded(boolean state);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,8 +1,7 @@
 | 
				
			|||||||
package com.jaquadro.minecraft.storagedrawers.api.storage.attribute;
 | 
					package com.jaquadro.minecraft.storagedrawers.api.storage.attribute;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Deprecated
 | 
				
			||||||
public interface IVoidable {
 | 
					public interface IVoidable {
 | 
				
			||||||
    /**
 | 
					    @Deprecated
 | 
				
			||||||
     * Gets whether or not the drawer has a voiding attribute.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    boolean isVoid();
 | 
					    boolean isVoid();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user