This commit is contained in:
Justin Aquadro committed 2014-11-24 02:20:09 -05:00
1 parent 8b4bcc8712
commit 1e1003d5e0
8 files changed
+78 -18

No files matched your search

@@ -31,6 +31,8 @@ public class StorageDrawers
public static final String MOD_VERSION = "1.2.0";
public static final String SOURCE_PATH = "com.jaquadro.minecraft.storagedrawers.";
public static final Api api = new Api();
public static final ModBlocks blocks = new ModBlocks();
public static final ModItems items = new ModItems();
public static final ModRecipes recipes = new ModRecipes();
@@ -0,0 +1,11 @@
package com.jaquadro.minecraft.storagedrawers.api;
import com.jaquadro.minecraft.storagedrawers.api.registry.IRecipeHandlerRegistry;
public interface IStorageDrawersApi
{
/**
* Recipe handlers are used to make custom recipes compatible with compacting drawers.
*/
IRecipeHandlerRegistry recipeHandlerRegistry ();
}
@@ -0,0 +1,28 @@
package com.jaquadro.minecraft.storagedrawers.api;
/**
* Entry point for the public API.
*/
public class StorageDrawersApi
{
private static IStorageDrawersApi instance;
/**
* API entry point.
*
* @return The {@link IStorageDrawersApi} instance or null if the API or Storage Drawers is unavailable.
*/
public static IStorageDrawersApi instance () {
if (instance == null) {
try {
Class classApi = Class.forName( "com.jaquadro.minecraft.storagedrawers.core.Api" );
instance = (IStorageDrawersApi) classApi.getField("instance").get(null);
}
catch (Throwable t) {
return null;
}
}
return instance;
}
}
@@ -9,7 +9,7 @@ public interface IDrawerInventory extends ISidedInventory
*
* @param inventorySlot An IInventory slot index returned from getInventorySlot.
*/
public int getDrawerSlot (int inventorySlot);
int getDrawerSlot (int inventorySlot);
/**
* Gets an IInventory slot index suitable for operations for the given type.
@@ -17,12 +17,12 @@ public interface IDrawerInventory extends ISidedInventory
* @param drawerSlot The index of the drawer within its group.
* @param type The type of IInventory slot to return an index for.
*/
public int getInventorySlot (int drawerSlot, SlotType type);
int getInventorySlot (int drawerSlot, SlotType type);
/**
* Gets the type associated with a given IInventory slot index.
*
* @param inventorySlot An IInventory slot index returned from getInventorySlot.
*/
public SlotType getInventorySlotType (int inventorySlot);
SlotType getInventorySlotType (int inventorySlot);
}
@@ -4,7 +4,7 @@ import net.minecraft.item.ItemStack;
public interface IInventoryAdapter
{
public ItemStack getInventoryStack (SlotType slotType);
ItemStack getInventoryStack (SlotType slotType);
public void syncInventory ();
void syncInventory ();
}
@@ -9,13 +9,13 @@ public interface IDrawer
* Gets an ItemStack of size 1 representing the type, metadata, and tags of the stored items.
* The returned ItemStack should not be modified for any reason. Make a copy if you need to store or modify it.
*/
public ItemStack getStoredItemPrototype ();
ItemStack getStoredItemPrototype ();
/**
* Gets an ItemStack initialized to the number of items stored in this drawer.
* The returned ItemStack is guaranteed to be a new copy and can be used for any purpose. Does not affect drawer contents.
*/
public ItemStack getStoredItemCopy ();
ItemStack getStoredItemCopy ();
/**
* Sets the type of the stored item and initializes it to the given amount. Any existing item will be replaced.
@@ -23,12 +23,12 @@ public interface IDrawer
* @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.
*/
public void setStoredItem (ItemStack itemPrototype, int amount);
void setStoredItem (ItemStack itemPrototype, int amount);
/**
* Gets the number of items stored in this drawer.
*/
public int getStoredItemCount ();
int getStoredItemCount ();
/**
* Sets the number of items stored in this drawer. Triggers syncing of inventories and client data.
@@ -36,23 +36,23 @@ public interface IDrawer
*
* @param amount The new amount of items stored in this drawer.
*/
public void setStoredItemCount (int amount);
void setStoredItemCount (int amount);
/**
* 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.
*/
public int getMaxCapacity ();
int getMaxCapacity ();
/**
* Gets the number of items that could still be added to this drawer before it is full.
*/
public int getRemainingCapacity ();
int getRemainingCapacity ();
/**
* Gets the max stack size of the item type stored in this drawer. Convenience method.
*/
public int getStoredItemStackSize ();
int getStoredItemStackSize ();
/**
* Gets whether or not an item of the given type and data can be stored in this drawer.
@@ -81,7 +81,7 @@ public interface IDrawer
*/
boolean isEmpty ();
public void writeToNBT (NBTTagCompound tag);
void writeToNBT (NBTTagCompound tag);
public void readFromNBT (NBTTagCompound tag);
void readFromNBT (NBTTagCompound tag);
}
@@ -5,15 +5,15 @@ public interface IDrawerGroup
/**
* Gets the number of drawers contained within this group.
*/
public int getDrawerCount ();
int getDrawerCount ();
/**
* Gets the drawer at the given slot within this group.
*/
public IDrawer getDrawer (int slot);
IDrawer getDrawer (int slot);
/**
* Gets whether the drawer in the given slot is usable.
*/
public boolean isDrawerEnabled (int slot);
boolean isDrawerEnabled (int slot);
}
@@ -0,0 +1,19 @@
package com.jaquadro.minecraft.storagedrawers.core;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.IStorageDrawersApi;
import com.jaquadro.minecraft.storagedrawers.api.registry.IRecipeHandlerRegistry;
public class Api implements IStorageDrawersApi
{
public static IStorageDrawersApi instance;
public Api () {
instance = this;
}
@Override
public IRecipeHandlerRegistry recipeHandlerRegistry () {
return StorageDrawers.recipeHandlerRegistry;
}
}