diff options
| author | Lance5057 <Lance5057@gmail.com> | 2015-01-21 20:04:34 -0600 |
|---|---|---|
| committer | Lance5057 <Lance5057@gmail.com> | 2015-01-21 20:04:34 -0600 |
| commit | b4eb8f2d65c62afccc898808b44fdddfde0c15d1 (patch) | |
| tree | ee3a9f47a22418a6778c299cc96b4fedc2265afe /src/api/java/cofh | |
| parent | 39642dce74d23f025b71d5766c1ac8489a41a802 (diff) | |
Startup
I hope I'm doing this right...
Diffstat (limited to 'src/api/java/cofh')
| -rw-r--r-- | src/api/java/cofh/api/energy/IEnergyContainerItem.java | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/api/java/cofh/api/energy/IEnergyContainerItem.java b/src/api/java/cofh/api/energy/IEnergyContainerItem.java new file mode 100644 index 0000000..0bcfda6 --- /dev/null +++ b/src/api/java/cofh/api/energy/IEnergyContainerItem.java @@ -0,0 +1,52 @@ +package cofh.api.energy; + +import net.minecraft.item.ItemStack; + +/** + * Implement this interface on Item classes that support external manipulation of their internal energy storages. + * + * A reference implementation is provided {@link ItemEnergyContainer}. + * + * @author King Lemming + * + */ +public interface IEnergyContainerItem { + + /** + * Adds energy to a container item. Returns the quantity of energy that was accepted. This should always return 0 if the item cannot be externally charged. + * + * @param container + * ItemStack to be charged. + * @param maxReceive + * Maximum amount of energy to be sent into the item. + * @param simulate + * If TRUE, the charge will only be simulated. + * @return Amount of energy that was (or would have been, if simulated) received by the item. + */ + int receiveEnergy(ItemStack container, int maxReceive, boolean simulate); + + /** + * Removes energy from a container item. Returns the quantity of energy that was removed. This should always return 0 if the item cannot be externally + * discharged. + * + * @param container + * ItemStack to be discharged. + * @param maxExtract + * Maximum amount of energy to be extracted from the item. + * @param simulate + * If TRUE, the discharge will only be simulated. + * @return Amount of energy that was (or would have been, if simulated) extracted from the item. + */ + int extractEnergy(ItemStack container, int maxExtract, boolean simulate); + + /** + * Get the amount of energy currently stored in the container item. + */ + int getEnergyStored(ItemStack container); + + /** + * Get the max amount of energy that can be stored in the container item. + */ + int getMaxEnergyStored(ItemStack container); + +} |
