Clean up backpack API

This commit is contained in:
mezz committed 2016-03-04 02:38:23 -08:00
1 parent 039af049aa
commit 2d4c180389
24 files changed
+153 -180

No files matched your search

@@ -5,23 +5,13 @@
******************************************************************************/
package forestry.api.storage;
import java.util.ArrayList;
import java.util.HashMap;
import net.minecraft.item.ItemStack;
public class BackpackManager {
/**
* 0 - Miner's Backpack 1 - Digger's Backpack 2 - Forester's Backpack 3 - Hunter's Backpack 4 - Adventurer's Backpack
*
* Use IMC messages to achieve the same effect!
*/
public static ArrayList<ItemStack>[] backpackItems;
public static final String MINER_UID = "forestry.miner";
public static final String DIGGER_UID = "forestry.digger";
public static final String FORESTER_UID = "forestry.forester";
public static final String ADVENTURER_UID = "forestry.adventurer";
public static final String BUILDER_UID = "forestry.builder";
public static final String HUNTER_UID = "forestry.hunter";
public static IBackpackInterface backpackInterface;
/**
* Only use this if you know what you are doing. Prefer backpackInterface.
*/
public static HashMap<String, IBackpackDefinition> definitions = new HashMap<>();
}
@@ -6,5 +6,5 @@
package forestry.api.storage;
public enum EnumBackpackType {
APIARIST, T1, T2
NORMAL, WOVEN, NATURALIST
}
@@ -11,11 +11,6 @@ import net.minecraft.item.ItemStack;
public interface IBackpackDefinition {
/**
* @return A unique string identifier
*/
String getKey();
/**
* @return Human-readable name of the backpack.
*/
@@ -5,9 +5,23 @@
******************************************************************************/
package forestry.api.storage;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.item.Item;
public interface IBackpackInterface {
/**
* Get a backpack with a given uid so you can add items to it or get information about it.
* returns null if there is no backpack for the given uid.
*/
@Nullable
IBackpackDefinition getBackpack(@Nonnull String uid);
/**
* Register a backpack with a given uid
*/
void registerBackpack(@Nonnull String uid, @Nonnull IBackpackDefinition definition);
/**
* Adds a backpack with the given definition and type, returning the item.
@@ -15,8 +29,10 @@ public interface IBackpackInterface {
* @param definition
* Definition of backpack behaviour.
* @param type
* Type of backpack. (T1 or T2 (= Woven)
* Type of backpack.
* @return Created backpack item.
*/
Item addBackpack(IBackpackDefinition definition, EnumBackpackType type);
@Nonnull
Item createBackpack(@Nonnull IBackpackDefinition definition, @Nonnull EnumBackpackType type);
}