From 1580d968ec7e2b358d2a74284a6b9046849bfd20 Mon Sep 17 00:00:00 2001 From: "Aidan C. Brady" Date: Mon, 16 Mar 2015 11:12:48 -0400 Subject: [PATCH] Updated CoFH API --- src/api/java/cofh/api/CoFHAPIProps.java | 2 +- .../java/cofh/api/item/IEmpowerableItem.java | 41 +++++++++++++++++++ .../api/item/IInventoryContainerItem.java | 20 +++++++++ src/api/java/cofh/api/item/package-info.java | 10 +++++ src/api/java/cofh/api/package-info.java | 9 ++++ 5 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 src/api/java/cofh/api/item/IEmpowerableItem.java create mode 100644 src/api/java/cofh/api/item/IInventoryContainerItem.java create mode 100644 src/api/java/cofh/api/item/package-info.java create mode 100644 src/api/java/cofh/api/package-info.java diff --git a/src/api/java/cofh/api/CoFHAPIProps.java b/src/api/java/cofh/api/CoFHAPIProps.java index 22096377f..ac3b23255 100644 --- a/src/api/java/cofh/api/CoFHAPIProps.java +++ b/src/api/java/cofh/api/CoFHAPIProps.java @@ -6,6 +6,6 @@ public class CoFHAPIProps { } - public static final String VERSION = "1.7.10R1.0.1"; + public static final String VERSION = "1.7.10R1.0.10"; } diff --git a/src/api/java/cofh/api/item/IEmpowerableItem.java b/src/api/java/cofh/api/item/IEmpowerableItem.java new file mode 100644 index 000000000..f77c71f6a --- /dev/null +++ b/src/api/java/cofh/api/item/IEmpowerableItem.java @@ -0,0 +1,41 @@ +package cofh.api.item; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +/** + * Implement this interface on Item classes which may be "Empowered" - what that means is completely up to you. This just provides a uniform way of dealing with + * them. + * + * @author King Lemming + * + */ +public interface IEmpowerableItem { + + /** + * Check whether or not a given item is currently in an empowered state. + */ + boolean isEmpowered(ItemStack stack); + + /** + * Attempt to set the empowered state of the item. + * + * @param stack + * ItemStack to be empowered/disempowered. + * @param state + * Desired state. + * @return TRUE if the operation was successful, FALSE if it was not. + */ + boolean setEmpoweredState(ItemStack stack, boolean state); + + /** + * Callback method for reacting to a state change. Useful in KeyBinding handlers. + * + * @param player + * Player holding the item, if applicable. + * @param stack + * The item being held. + */ + void onStateChange(EntityPlayer player, ItemStack stack); + +} diff --git a/src/api/java/cofh/api/item/IInventoryContainerItem.java b/src/api/java/cofh/api/item/IInventoryContainerItem.java new file mode 100644 index 000000000..b87896ccc --- /dev/null +++ b/src/api/java/cofh/api/item/IInventoryContainerItem.java @@ -0,0 +1,20 @@ +package cofh.api.item; + +import net.minecraft.item.ItemStack; + +/** + * Implement this interface on Item classes that are themselves inventories. + * + * A reference implementation is provided {@link ItemInventoryContainer}. + * + * @author King Lemming + * + */ +public interface IInventoryContainerItem { + + /** + * Get the size of this inventory of this container item. + */ + int getSizeInventory(ItemStack container); + +} diff --git a/src/api/java/cofh/api/item/package-info.java b/src/api/java/cofh/api/item/package-info.java new file mode 100644 index 000000000..49608fd13 --- /dev/null +++ b/src/api/java/cofh/api/item/package-info.java @@ -0,0 +1,10 @@ +/** + * (C) 2014 Team CoFH / CoFH / Cult of the Full Hub + * http://www.teamcofh.com + */ +@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHAPI", provides = "CoFHAPI|item") +package cofh.api.item; + +import cofh.api.CoFHAPIProps; +import cpw.mods.fml.common.API; + diff --git a/src/api/java/cofh/api/package-info.java b/src/api/java/cofh/api/package-info.java new file mode 100644 index 000000000..08ff5fcb6 --- /dev/null +++ b/src/api/java/cofh/api/package-info.java @@ -0,0 +1,9 @@ +/** + * (C) 2014 Team CoFH / CoFH / Cult of the Full Hub + * http://www.teamcofh.com + */ +@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHLib", provides = "CoFHAPI") +package cofh.api; + +import cpw.mods.fml.common.API; +