From b4eb8f2d65c62afccc898808b44fdddfde0c15d1 Mon Sep 17 00:00:00 2001 From: Lance5057 Date: Wed, 21 Jan 2015 20:04:34 -0600 Subject: Startup I hope I'm doing this right... --- .../java/cofh/api/energy/IEnergyContainerItem.java | 52 ++++++ src/api/java/mcp/mobius/waila/api/IWailaBlock.java | 34 ++++ .../mcp/mobius/waila/api/IWailaBlockDecorator.java | 9 + .../mcp/mobius/waila/api/IWailaConfigHandler.java | 28 +++ .../mcp/mobius/waila/api/IWailaDataAccessor.java | 33 ++++ .../mcp/mobius/waila/api/IWailaDataProvider.java | 33 ++++ .../mcp/mobius/waila/api/IWailaEntityAccessor.java | 24 +++ .../mcp/mobius/waila/api/IWailaEntityProvider.java | 16 ++ .../mcp/mobius/waila/api/IWailaFMPAccessor.java | 27 +++ .../mcp/mobius/waila/api/IWailaFMPDecorator.java | 7 + .../mcp/mobius/waila/api/IWailaFMPProvider.java | 12 ++ .../java/mcp/mobius/waila/api/IWailaRegistrar.java | 44 +++++ .../mobius/waila/api/IWailaSummaryProvider.java | 21 +++ .../java/mcp/mobius/waila/api/SpecialChars.java | 40 ++++ .../java/mcp/mobius/waila/api/package-info.java | 3 + src/api/java/morph/api/Ability.java | 208 +++++++++++++++++++++ src/api/java/morph/api/Api.java | 170 +++++++++++++++++ .../minefactoryreloaded/api/FactoryRegistry.java | 113 +++++++++++ .../minefactoryreloaded/api/HarvestType.java | 44 +++++ .../minefactoryreloaded/api/IFactoryGrindable.java | 35 ++++ .../api/IFactoryHarvestable.java | 71 +++++++ .../api/ILiquidDrinkHandler.java | 8 + .../minefactoryreloaded/api/MobDrop.java | 21 +++ .../minefactoryreloaded/api/ValuedItem.java | 72 +++++++ src/api/java/thaumcraft/api/IGoggles.java | 22 +++ 25 files changed, 1147 insertions(+) create mode 100644 src/api/java/cofh/api/energy/IEnergyContainerItem.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaBlock.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaDataProvider.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaRegistrar.java create mode 100644 src/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java create mode 100644 src/api/java/mcp/mobius/waila/api/SpecialChars.java create mode 100644 src/api/java/mcp/mobius/waila/api/package-info.java create mode 100644 src/api/java/morph/api/Ability.java create mode 100644 src/api/java/morph/api/Api.java create mode 100644 src/api/java/powercrystals/minefactoryreloaded/api/FactoryRegistry.java create mode 100644 src/api/java/powercrystals/minefactoryreloaded/api/HarvestType.java create mode 100644 src/api/java/powercrystals/minefactoryreloaded/api/IFactoryGrindable.java create mode 100644 src/api/java/powercrystals/minefactoryreloaded/api/IFactoryHarvestable.java create mode 100644 src/api/java/powercrystals/minefactoryreloaded/api/ILiquidDrinkHandler.java create mode 100644 src/api/java/powercrystals/minefactoryreloaded/api/MobDrop.java create mode 100644 src/api/java/powercrystals/minefactoryreloaded/api/ValuedItem.java create mode 100644 src/api/java/thaumcraft/api/IGoggles.java (limited to 'src/api') 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); + +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaBlock.java b/src/api/java/mcp/mobius/waila/api/IWailaBlock.java new file mode 100644 index 0000000..8b4dd13 --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaBlock.java @@ -0,0 +1,34 @@ +package mcp.mobius.waila.api; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +@Deprecated +public interface IWailaBlock { + /* + * Use this method to return an item stack in case the default lookup system fails. + * Return null if you want to use the default lookup system. + * You get the world, the player and the location of the block. With that, it is easy to gather information & tile entities + */ + ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config); + + /* Waila HUD is divided into 3 zones. The head corresponds to the item name, + * body to where you mostly want to put informations, and I reserve the tail for modname display + */ + + /* Those 2 methods works exactly the same way, except they are related to a different zone in Waila HUD. + * You get in input world, player and the block location. You also get the itemstack as returned by the default lookup system or getWailaStack(). + * ConfigHandler provides the current Waila config state so you can show/hide elements depending on the configuration. Refer the ConfigHandler class for more info. + * currenttip represents the current list of text lines in the tooltip zone. + * For example, getWailaHead() will have the current item name as currenttip. + * You can modify the tips, add more, remove some, etc. + * When you are done, just returns the currenttip and it will display in Waila. + * + * Always return the currenttip is you don't want to modify the current zone. + */ + + List getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); + List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); + List getWailaTail(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java b/src/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java new file mode 100644 index 0000000..935d475 --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java @@ -0,0 +1,9 @@ +package mcp.mobius.waila.api; + +import net.minecraft.item.ItemStack; + +public interface IWailaBlockDecorator { + + void decorateBlock(ItemStack itemStack, IWailaDataAccessor accessor, IWailaConfigHandler config); + +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java b/src/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java new file mode 100644 index 0000000..faede63 --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java @@ -0,0 +1,28 @@ +package mcp.mobius.waila.api; + +import java.util.HashMap; +import java.util.Set; + +public interface IWailaConfigHandler { + /* Returns a set of all the currently loaded modules in the config handler */ + public Set getModuleNames(); + + /* Returns all the currently available options for a given module */ + public HashMap getConfigKeys(String modName); + + /* Add a new option to a given module + * + * modName is the name of the module to add the option to (ie : Buildcraft, IndustrialCraft2, etc) + * key is the config key (ie : bc.tankcontent, ic2.inputvalue) + * name is the human readable name of the option (ie : "Tank content", "Max EU Input") + * */ + //public void addConfig(String modName, String key, String name); + + /* Returns the current value of an option (true/false) with a default value defvalue if not set*/ + public boolean getConfig(String key, boolean defvalue); + + /* Returns the current value of an option (true/false) with a default value true if not set*/ + public boolean getConfig(String key); + + //public void setConfig(String key, boolean value); +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java b/src/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java new file mode 100644 index 0000000..0288624 --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java @@ -0,0 +1,33 @@ +package mcp.mobius.waila.api; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +/* The Accessor is used to get some basic data out of the game without having to request + * direct access to the game engine. + * It will also return things that are unmodified by the overriding systems (like getWailaStack). + */ + +public interface IWailaDataAccessor { + + World getWorld(); + EntityPlayer getPlayer(); + Block getBlock(); + int getBlockID(); + int getMetadata(); + TileEntity getTileEntity(); + MovingObjectPosition getPosition(); + Vec3 getRenderingPosition(); + NBTTagCompound getNBTData(); + int getNBTInteger(NBTTagCompound tag, String keyname); + double getPartialFrame(); + ForgeDirection getSide(); + ItemStack getStack(); +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaDataProvider.java b/src/api/java/mcp/mobius/waila/api/IWailaDataProvider.java new file mode 100644 index 0000000..4859d9c --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaDataProvider.java @@ -0,0 +1,33 @@ +package mcp.mobius.waila.api; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +public interface IWailaDataProvider{ + /* + * Use this method to return an item stack in case the default lookup system fails. + * Return null if you want to use the default lookup system. + * You get the world, the player and the location of the block. With that, it is easy to gather information & tile entities + */ + ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config); + + /* Waila HUD is divided into 3 zones. The head corresponds to the item name, + * body to where you mostly want to put informations, and I reserve the tail for modname display + */ + + /* Those 2 methods works exactly the same way, except they are related to a different zone in Waila HUD. + * You get in input world, player and the block location. You also get the itemstack as returned by the default lookup system or getWailaStack(). + * ConfigHandler provides the current Waila config state so you can show/hide elements depending on the configuration. Refer the ConfigHandler class for more info. + * currenttip represents the current list of text lines in the tooltip zone. + * For example, getWailaHead() will have the current item name as currenttip. + * You can modify the tips, add more, remove some, etc. + * When you are done, just returns the currenttip and it will display in Waila. + * + * Always return the currenttip is you don't want to modify the current zone. + */ + + List getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); + List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); + List getWailaTail(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java b/src/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java new file mode 100644 index 0000000..788067a --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java @@ -0,0 +1,24 @@ +package mcp.mobius.waila.api; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +/* The Accessor is used to get some basic data out of the game without having to request + * direct access to the game engine. + * It will also return things that are unmodified by the overriding systems (like getWailaStack). + */ + +public interface IWailaEntityAccessor { + World getWorld(); + EntityPlayer getPlayer(); + Entity getEntity(); + MovingObjectPosition getPosition(); + Vec3 getRenderingPosition(); + NBTTagCompound getNBTData(); + int getNBTInteger(NBTTagCompound tag, String keyname); + double getPartialFrame(); +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java b/src/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java new file mode 100644 index 0000000..9548289 --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java @@ -0,0 +1,16 @@ +package mcp.mobius.waila.api; + +import java.util.List; + +import net.minecraft.entity.Entity; + +public interface IWailaEntityProvider { + + /* A way to get an override on the entity returned by the raytracing */ + Entity getWailaOverride(IWailaEntityAccessor accessor, IWailaConfigHandler config); + + /* The classical HEAD/BODY/TAIL text getters */ + List getWailaHead(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); + List getWailaBody(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); + List getWailaTail(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java b/src/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java new file mode 100644 index 0000000..19e01fa --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java @@ -0,0 +1,27 @@ +package mcp.mobius.waila.api; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +/* The Accessor is used to get some basic data out of the game without having to request + * direct access to the game engine. + * It will also return things that are unmodified by the overriding systems (like getWailaStack). + */ + +public interface IWailaFMPAccessor { + World getWorld(); + EntityPlayer getPlayer(); + TileEntity getTileEntity(); + MovingObjectPosition getPosition(); + NBTTagCompound getNBTData(); + NBTTagCompound getFullNBTData(); + int getNBTInteger(NBTTagCompound tag, String keyname); + double getPartialFrame(); + Vec3 getRenderingPosition(); + String getID(); +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java b/src/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java new file mode 100644 index 0000000..839af31 --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java @@ -0,0 +1,7 @@ +package mcp.mobius.waila.api; + +import net.minecraft.item.ItemStack; + +public interface IWailaFMPDecorator { + void decorateBlock(ItemStack itemStack, IWailaFMPAccessor accessor, IWailaConfigHandler config); +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java b/src/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java new file mode 100644 index 0000000..232c83e --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java @@ -0,0 +1,12 @@ +package mcp.mobius.waila.api; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +public interface IWailaFMPProvider { + /* The classical HEAD/BODY/TAIL text getters */ + List getWailaHead(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); + List getWailaBody(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); + List getWailaTail(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaRegistrar.java b/src/api/java/mcp/mobius/waila/api/IWailaRegistrar.java new file mode 100644 index 0000000..162aeb6 --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaRegistrar.java @@ -0,0 +1,44 @@ +package mcp.mobius.waila.api; + +public interface IWailaRegistrar { + /* Add a config option in the section modname with displayed text configtext and access key keyname */ + public void addConfig(String modname, String keyname, String configtext); + public void addConfigRemote(String modname, String keyname, String configtext); + public void addConfig(String modname, String keyname); + public void addConfigRemote(String modname, String keyname); + + /* Register a stack overrider for the given blockID */ + public void registerStackProvider(IWailaDataProvider dataProvider, Class block); + + /* Same thing, but works on a class hierarchy instead */ + public void registerHeadProvider (IWailaDataProvider dataProvider, Class block); + public void registerBodyProvider (IWailaDataProvider dataProvider, Class block); + public void registerTailProvider (IWailaDataProvider dataProvider, Class block); + + /* Entity text registration methods */ + public void registerHeadProvider (IWailaEntityProvider dataProvider, Class entity); + public void registerBodyProvider (IWailaEntityProvider dataProvider, Class entity); + public void registerTailProvider (IWailaEntityProvider dataProvider, Class entity); + public void registerOverrideEntityProvider (IWailaEntityProvider dataProvider, Class entity); + + /* FMP Providers */ + public void registerHeadProvider(IWailaFMPProvider dataProvider, String name); + public void registerBodyProvider(IWailaFMPProvider dataProvider, String name); + public void registerTailProvider(IWailaFMPProvider dataProvider, String name); + + /* The block decorators */ + public void registerDecorator (IWailaBlockDecorator decorator, Class block); + public void registerDecorator (IWailaFMPDecorator decorator, String name); + + /* Selective NBT key syncing. Will register a key to sync over the network for the given class (block, te or ent). + * Accept * as a ending wildcard + * registerNBTKey("bob.*", MyBlock.class) + * registerNBTKey("data.life", MyEntity.class) + * registerNBTKey("*", MyTileEntity.class) will reproduce the full tag syncing from 1.4.5 + * */ + public void registerSyncedNBTKey(String key, Class target); + + /* UNUSED FOR NOW (Will be used for the ingame wiki */ + public void registerDocTextFile (String filename); + public void registerShortDataProvider (IWailaSummaryProvider dataProvider, Class item); +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java b/src/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java new file mode 100644 index 0000000..f790649 --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java @@ -0,0 +1,21 @@ +package mcp.mobius.waila.api; + +import java.util.LinkedHashMap; + +import net.minecraft.item.ItemStack; + +public interface IWailaSummaryProvider { + /* This interface is used to control the display data in the description screen */ + + /* BASIC TOOLS & ITEMS DATA */ + //EnumToolMaterial getMaterial(ItemStack stack); + //String getMaterialName(ItemStack stack); + //String getEffectiveBlock(ItemStack stack); + //int getHarvestLevel(ItemStack stack); + //float getEfficiencyOnProperMaterial(ItemStack stack); + //int getEnchantability(ItemStack stack); + //int getDamageVsEntity(ItemStack stack); + //int getDurability(ItemStack stack); + + LinkedHashMap getSummary(ItemStack stack, LinkedHashMap currentSummary, IWailaConfigHandler config); +} diff --git a/src/api/java/mcp/mobius/waila/api/SpecialChars.java b/src/api/java/mcp/mobius/waila/api/SpecialChars.java new file mode 100644 index 0000000..5bd92a8 --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/SpecialChars.java @@ -0,0 +1,40 @@ +package mcp.mobius.waila.api; + +public class SpecialChars { + + public static String MCStyle = "\u00A7"; + + public static String BLACK = MCStyle + "0"; + public static String DBLUE = MCStyle + "1"; + public static String DGREEN = MCStyle + "2"; + public static String DAQUA = MCStyle + "3"; + public static String DRED = MCStyle + "4"; + public static String DPURPLE = MCStyle + "5"; + public static String GOLD = MCStyle + "6"; + public static String GRAY = MCStyle + "7"; + public static String DGRAY = MCStyle + "8"; + public static String BLUE = MCStyle + "9"; + public static String GREEN = MCStyle + "a"; + public static String AQUA = MCStyle + "b"; + public static String RED = MCStyle + "c"; + public static String LPURPLE = MCStyle + "d"; + public static String YELLOW = MCStyle + "e"; + public static String WHITE = MCStyle + "f"; + + public static String OBF = MCStyle + "k"; + public static String BOLD = MCStyle + "l"; + public static String STRIKE = MCStyle + "m"; + public static String UNDER = MCStyle + "n"; + public static String ITALIC = MCStyle + "o"; + public static String RESET = MCStyle + "r"; + + public static String WailaStyle = "\u00A4"; + public static String WailaIcon = "\u00A5"; + public static String TAB = WailaStyle + WailaStyle +"a"; + public static String ALIGNRIGHT = WailaStyle + WailaStyle +"b"; + public static String ALIGNCENTER = WailaStyle + WailaStyle +"c"; + public static String HEART = WailaStyle + WailaIcon +"a"; + public static String HHEART = WailaStyle + WailaIcon +"b"; + public static String EHEART = WailaStyle + WailaIcon +"c"; + +} diff --git a/src/api/java/mcp/mobius/waila/api/package-info.java b/src/api/java/mcp/mobius/waila/api/package-info.java new file mode 100644 index 0000000..9b5e663 --- /dev/null +++ b/src/api/java/mcp/mobius/waila/api/package-info.java @@ -0,0 +1,3 @@ +@API(apiVersion="1.0",owner="Waila",provides="WailaAPI") +package mcp.mobius.waila.api; +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/api/java/morph/api/Ability.java b/src/api/java/morph/api/Ability.java new file mode 100644 index 0000000..36a75e9 --- /dev/null +++ b/src/api/java/morph/api/Ability.java @@ -0,0 +1,208 @@ +package morph.api; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/** + * + * Abstract ability class. + * Think of it like the Entity class, extend it to make your own types. + * Some abilities may seem more like traits, but let's just call it an ability for simplicity's sake. + * Please take note that entities inherit their superclass' abilities. + * @author iChun + * + */ +public abstract class Ability +{ + /** + * Ability parent field. Will be null for instances used in registration. Ability is then cloned and parent assigned later on. + */ + private EntityLivingBase parent; + + /** + * Flag for Ability activity. If true, tick/postRender/kill will notbe called. + */ + public boolean inactive; + + /** + * Basic constructor (but you didn't really need me to tell you that ;D ) + */ + public Ability() + { + parent = null; + } + + /** + * Function for mod mob support, with args. + */ + public Ability parse(String[] args) { return this; } + + /** + * Since parent is private it needs a setter. + * @param newParent + */ + public void setParent(EntityLivingBase ent) + { + parent = ent; + } + + /** + * Get's the parent entity for this ability + * @return Entity the ability takes effect on + */ + public EntityLivingBase getParent() + { + return parent; + } + + /** + * Each ability has to return a String type. + * This is used for comparison, saving, as well as construction/loading of Ability. + * Think of it like the way Minecraft registers entities. + * @return Ability type + */ + public abstract String getType(); + + /** + * Ticks every world tick, basically an ability onUpdate, similar to Entity's onUpdate. + * Will only tick if getParent() is not null. + * Please remember that getParent is not necessarily a player. + */ + public abstract void tick(); + + /** + * Called when the ability is finally removed when the parent demorphs or morphs into a state that does not have this ability type. + * This will NOT be called if the parent morphs into another morph that has this type of ability. + */ + public abstract void kill(); + + /** + * Creates a copy of this ability for use with parents. + * As previously stated before the ability instance used during registration is a base so it needs to be cloned for use with parents. + */ + public abstract Ability clone(); + + /** + * Return true for this if you need an inactive copy of this morph in-between morph states (abilities of the next morph are only swapped over when morph is complete) + * Currently used for AbilitySwim to adjust the fog render. + * @return requiresInactiveClone + */ + public boolean requiresInactiveClone() + { + return false; + } + + /** + * Saving of ability to NBTTagCompound. + * Mainly used for synching Abilities between the client-server for mod mobs which do not use the API to add abilities. + * The ability type (getType()) is appended to nbt before function is called. + * Not actually used. + * @param NBTTagCompound saveData + */ + public abstract void save(NBTTagCompound tag); + + /** + * Loading of ability from NBTTagCompound. + * Mainly used to load custom fields from NBT. + * Not actually used. + * @param NBTTagCompound saveData + */ + public abstract void load(NBTTagCompound tag); + + /** + * Rendering to be done post-render. + * EG: Used by AbilitySwim to render air bubbles whilst on land. + */ + @SideOnly(Side.CLIENT) + public abstract void postRender(); + + /** + * Icon location for ability. Can be null. + * Mod's default icons are 32x32. Can be any resolution though. + * @return resourcelocation for icon + */ + @SideOnly(Side.CLIENT) + public abstract ResourceLocation getIcon(); + + @SideOnly(Side.CLIENT) + public boolean entityHasAbility(EntityLivingBase living) + { + return true; + } + + /** + * Registers the ability so the mod can look up the class when attempting to load Ability save data. + * Call this no later than PostInit. + * @param ability type + * @param AbilityClass + */ + public static void registerAbility(String name, Class clz) + { + try { + Class.forName("morph.common.ability.AbilityHandler").getDeclaredMethod("registerAbility", String.class, Class.class).invoke(null, name, clz); + } catch (Exception e) { + } + } + + /** + * Maps abilities to an Entity. + * Adds on to the previous ability list, so this allows you to add abilities to Entity classes which already have abilities mapped. + * However, only one ability of the same type is allowed for each entity. This method will overwrite abilities of the same type that were already mapped. + * This will also register new abilities which were not registered before (just in case). + * Call this no later than PostInit. + * @param entClass + * @param abilities + */ + public static void mapAbilities(Class entClass, Ability...abilities) + { + try { + Class.forName("morph.common.ability.AbilityHandler").getDeclaredMethod("mapAbilities", Class.class, Ability[].class).invoke(null, entClass, abilities); + } catch (Exception e) { + } + } + + /** + * Superman's kryptonite. + * @param Entity class to remove ability from + * @param Ability type + */ + public static void removeAbility(Class entClass, String type) + { + try { + Class.forName("morph.common.ability.AbilityHandler").getDeclaredMethod("removeAbility", Class.class, String.class).invoke(null, entClass, type); + } catch (Exception e) { + } + } + + /** + * Checks to see if the entity class has a mapped ability type. + * @param entClass + * @param Ability type + * @return Entity class has ability type + */ + public static boolean hasAbility(Class entClass, String type) + { + try { + return (Boolean)Class.forName("morph.common.ability.AbilityHandler").getDeclaredMethod("hasAbility", Class.class, String.class).invoke(null, entClass, type); + } catch (Exception e) { + return false; + } + } + + /** + * Creates an ability by type. + * Check out AbilityHandler to see each Ability type and the parse function in their respective classes for the arguments. + * @return + */ + public static Ability createNewAbilityByType(String type, String[] arguments) + { + try { + return (Ability)Class.forName("morph.common.ability.AbilityHandler").getDeclaredMethod("createNewAbilityByType", String.class, String[].class).invoke(null, type, arguments); + } catch (Exception e) { + return null; + } + } +} diff --git a/src/api/java/morph/api/Api.java b/src/api/java/morph/api/Api.java new file mode 100644 index 0000000..1cfb49d --- /dev/null +++ b/src/api/java/morph/api/Api.java @@ -0,0 +1,170 @@ +package morph.api; + +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.util.ResourceLocation; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public final class Api +{ + /** + * Returns if a player is has a morph. If morph progress < 1.0F, player is mid-morphing. + * Players demorphing are considered as a player with a morph until the demorph is complete. + * @param Player Username + * @param Clientside (false for Serverside) + */ + public static boolean hasMorph(String playerName, boolean isClient) + { + try { + return (Boolean)Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("hasMorph", String.class, boolean.class).invoke(null, playerName, isClient); + } catch (Exception e) { + return false; + } + } + + /** + * Returns morph progression of a player. Time per morph is 80 ticks. + * If player does not have a morph, 1.0F will be returned. + * @param Player Username + * @param Clientside (false for Serverside) + */ + public static float morphProgress(String playerName, boolean isClient) + { + try { + return (Float)Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("morphProgress", String.class, boolean.class).invoke(null, playerName, isClient); + } catch (Exception e) { + return 1.0F; + } + } + + /** + * Returns previous entity instance used to render the morph. + * If player does not have a previous morph state, null will be returned. + * @param Player Username + * @param Clientside (false for Serverside) + */ + public static EntityLivingBase getPrevMorphEntity(String playerName, boolean isClient) + { + try { + return (EntityLivingBase)Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("getPrevMorphEntity", String.class, boolean.class).invoke(null, playerName, isClient); + } catch (Exception e) { + return null; + } + } + + /** + * Returns entity instance used to render the morph. + * If player does not have a morph, null will be returned. + * @param Player Username + * @param Clientside (false for Serverside) + */ + public static EntityLivingBase getMorphEntity(String playerName, boolean isClient) + { + try { + return (EntityLivingBase)Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("getMorphEntity", String.class, boolean.class).invoke(null, playerName, isClient); + } catch (Exception e) { + return null; + } + } + + /** + * Blacklists an entity from being morphed into. + * Previously saved morphs of the classtype will not be removed. + * @param Class (extends EntityLivingBase) + */ + public static void blacklistEntity(Class clz) + { + try { + Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("blacklistEntity", Class.class).invoke(null, clz); + } catch (Exception e) { + } + } + + /** + * Forces a player to morph into an EntityLivingBase, also adds said entity to the morph list. + * Called Serverside only. + * @param player + * @param living + * @return morphSuccessful + */ + public static boolean forceMorph(EntityPlayerMP player, EntityLivingBase living) + { + try { + return (Boolean)Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("forceMorph", EntityPlayerMP.class, EntityLivingBase.class).invoke(null, player, living); + } catch (Exception e) { + return false; + } + } + + /** + * Forces a player to demorph. + * Called Serverside only. + * @param player + */ + public static void forceDemorph(EntityPlayerMP player) + { + try { + Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("forceDemorph", EntityPlayerMP.class).invoke(null, player); + } catch (Exception e) { + } + } + + /** + * Checks if the entity passed on is a Morph. + * If it is, the player name will be passed, else null. + * @param EntityLivingBase instance + * @param Clientside (false for Serverside) + */ + public static String isEntityAMorph(EntityLivingBase living, boolean isClient) + { + try { + return (String)Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("isEntityAMorph", EntityLivingBase.class, boolean.class).invoke(null, living, isClient); + } catch (Exception e) { + return null; + } + } + + /** + * Allows the rendering of the next player rendered. + * Prevents Morph from cancelling the player render event to render the morphed entity. + */ + public static void allowNextPlayerRender() + { + try { + Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("allowNextPlayerRender").invoke(null); + } catch (Exception e) { + } + } + + /** + * Returns the black grainy morph skin that overlays the player when the player is morphing + * @return Morph Skin Resource Location + */ + @SideOnly(Side.CLIENT) + public static ResourceLocation getMorphSkinTexture() + { + try { + return (ResourceLocation)Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("getMorphSkinTexture").invoke(null); + } catch (Exception e) { + return AbstractClientPlayer.locationStevePng; + } + } + + /** + * Assign a specific arm to a model for rendering in First Person. + * @param model Model which arm you are registering for + * @param arm The arm in a ModelRenderer form. + */ + @SideOnly(Side.CLIENT) + public static void registerArmForModel(ModelBase model, ModelRenderer arm) + { + try { + Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("registerArmForModel", ModelBase.class, ModelRenderer.class).invoke(null, model, arm); + } catch (Exception e) { + } + } +} diff --git a/src/api/java/powercrystals/minefactoryreloaded/api/FactoryRegistry.java b/src/api/java/powercrystals/minefactoryreloaded/api/FactoryRegistry.java new file mode 100644 index 0000000..8eff88d --- /dev/null +++ b/src/api/java/powercrystals/minefactoryreloaded/api/FactoryRegistry.java @@ -0,0 +1,113 @@ +package powercrystals.minefactoryreloaded.api; + +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.event.FMLInterModComms; +import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; + +/** + * @author PowerCrystals + * + * Class used to register plants and other farming-related things with MFR. Will do nothing if MFR does not exist. + * + */ +public class FactoryRegistry +{ + /* + * This may be called at any time during pre-init, init or post-init, assuming all blocks and items + * that are being accessed from the registry have been appropriately registered. + * Possible messages: + * + * // Registration: + * addLaserPreferredOre | NBTTag with an ItemStack saved on it, with the color on the "value" attribute, + * | A ValuedItem with item and value set. + * registerAutoSpawnerBlacklist | The String identifier of an entity, + * | A subclass of EntityLivingBase. + * registerFertilizable | An instance of IFactoryFertilizable. + * registerFertilizer | An instance of IFactoryFertilizer. + * registerFruitLog | The String identifier of a block. + * registerGrindable | An instance of IFactoryGrindable. + * registerGrinderBlacklist | A subclass of EntityLivingBase. + * registerHarvestable | An instance of IFactoryHarvestable. + * registerLaserOre | NBTTag with an ItemStack saved on it, with the weight on the "value" attribute, + * | A ValuedItem with item and value set. + * registerLiquidDrinkHandler | A ValuedItem with key and object set; ILiquidDrinkHandler expected. + * registerMobEggHandler | An instance of IMobEggHandler. + * registerPickableFruit | An instance of IFactoryFruit. + * registerPlantable | An instance of IFactoryPlantable. + * registerRanchable | An instance of IFactoryRanchable. + * registerRedNetLogicCircuit | An instance of IRedNetLogicCircuit. + * registerRubberTreeBiome | The biomeName field of a biome to white list for rubber trees to spawn in. + * registerSafariNetBlacklist | A subclass of EntityLivingBase. + * registerSafariNetHandler | An instance of ISafariNetHandler. + * registerSludgeDrop | NBTTag with an ItemStack saved on it, with the weight on the "value" attribute, + * | A ValuedItem with item and value set. + * registerSpawnHandler | An instance of IMobSpawnHandler. + * registerVillagerTradeMob | An instance of IRandomMobProvider. + * + * // Simple implementations: + * { Harvestables + * registerHarvestable_Standard | The String identifier of a block. + * registerHarvestable_Log | The String identifier of a block. + * registerHarvestable_Leaves | The String identifier of a block. + * registerHarvestable_Vine | The String identifier of a block. + * registerHarvestable_Shrub | The String identifier of a block. + * registerHarvestable_Mushroom | The String identifier of a block. + * registerHarvestable_Crop | An ItemStack of a block, with a damage value indicating the meta value to harvest at. + * | A ValuedItem with value and object set; Block expected. + * registerHarvestable_Gourd | An NBTTag with the stem and fruit attributes, both String identifiers of blocks. + * } + * { Plantables + * registerPlantable_Standard | An NBTTag with the seed (Item, String identifier), and + * crop (Block, String identifier) attributes set, optionally + * also having the meta (Integer, placed metadata value) attribute set. + * No special checks for location, just sustainability. + * registerPlantable_Crop | An NBTTag with the seed (Item, String identifier), and + * crop (Block, String identifier) attributes set, optionally + * also having the meta (Integer, placed metadata value) attribute set. + * Will automatically hoe dirt and grass into farmland when planting. + * registerPlantable_Sapling | An NBTTag with the sapling (Block, String identifier), and optionally + * the seed (Item, String identifier) attributes set. + * } + * { Fertilizer + * registerFertilizer | An NBTTag with the fert (Item, String identifier), meta (Integer), and + * type (Integer, index into FertilizerType.values()) attributes set. + * } + * { Fertilizables + * registerFertilizable_Grass | The String identifier of a block. Will bonemeal the block and expect + * tall grass be planted above and around it, must be IGrowable. Works with + * the GrowPlant and Grass type fertilizers, not recommended for crop plants. + * registerFertilizable_Gourd | The String identifier of a block. Must be IGrowable, and expects identical + * behavior to vanilla stems. Works with the GrowPlant fertilizers. + * registerFertilizable_Crop | An NBTTag with the plant (Block, String identifier, IGrowable), and + * meta (Integer, max growth phase) attributes set, optionally also having + * the type (Integer, index into FertilizerType) attribute set. + * registerFertilizable_Cocoa | An NBTTag with the plant (Block, String identifier), and optionally also + * the type (Integer, index into FertilizerType) attributes set. + * Expects metadata of the block to exactly match cocoa pods. + * registerFertilizable_Standard | An NBTTag with the plant (Block, String identifier, IGrowable), and + * optionally also the type (Integer, index into FertilizerType) attributes set. + * Expects the block to change when successfully grown (e.g., saplings). + * } + */ + public static void sendMessage(String message, Object value) + { + if (!Loader.isModLoaded("MineFactoryReloaded") || + Loader.instance().activeModContainer() == null) + return; + try + { + Method m = FMLInterModComms.class.getDeclaredMethod("enqueueMessage", Object.class, String.class, IMCMessage.class); + m.setAccessible(true); + Constructor c = IMCMessage.class.getDeclaredConstructor(String.class, Object.class); + c.setAccessible(true); + m.invoke(null, Loader.instance().activeModContainer(), "MineFactoryReloaded", c.newInstance(message, value)); + } + catch(Exception e) + { + e.printStackTrace(); + } + } +} diff --git a/src/api/java/powercrystals/minefactoryreloaded/api/HarvestType.java b/src/api/java/powercrystals/minefactoryreloaded/api/HarvestType.java new file mode 100644 index 0000000..a56208e --- /dev/null +++ b/src/api/java/powercrystals/minefactoryreloaded/api/HarvestType.java @@ -0,0 +1,44 @@ +package powercrystals.minefactoryreloaded.api; + +/** + * @author PowerCrystals + * + * Determines what algorithm the Harvester uses when it encounters this IFactoryHarvestable in the world. + */ +public enum HarvestType +{ + /** + * Just break the single block - no special action needed. e.g. Carrots, flowers, wheat. + */ + Normal, + /** + * Search for harvestable blocks adjacent to this block but leave this block. e.g. Pumpkin, melon + */ + Gourd, + /** + * Search for identical blocks above. + */ + Column, + /** + * Search for identical blocks above but leave the bottom one for the future. e.g. Cactus, sugarcane. + */ + LeaveBottom, + /** + * This block is the base of a tree and the harvester should enter tree-cutting mode. + */ + Tree, + /** + * This block is the base of the tree and the harvester should enter tree-cutting mode. + * The tree is searched for in the negative y axis instead. + */ + TreeFlipped, + /** + * This block is part of a tree as above. + */ + TreeLeaf, + /** + * This block is part of a tree as above, but fruits are cut before logs. e.g. cocoa + * The tree is not searched for. + */ + TreeFruit +} diff --git a/src/api/java/powercrystals/minefactoryreloaded/api/IFactoryGrindable.java b/src/api/java/powercrystals/minefactoryreloaded/api/IFactoryGrindable.java new file mode 100644 index 0000000..edfb8c9 --- /dev/null +++ b/src/api/java/powercrystals/minefactoryreloaded/api/IFactoryGrindable.java @@ -0,0 +1,35 @@ +package powercrystals.minefactoryreloaded.api; + +import java.util.List; +import java.util.Random; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.world.World; + +/** + * @author PowerCrystals + * + * Defines a grindable entity for the Grinder. + */ +public interface IFactoryGrindable +{ + /** + * @return The class that this grindable instance is handling. This must be a subtype of EntityLivingBase or the entity will never + * be noticed by the Grinder. + */ + public Class getGrindableEntity(); + + /** + * @param world The world this entity is in. + * @param entity The entity instance being ground. + * @param random A Random instance. + * @return The drops generated when this entity is killed. + */ + public List grind(World world, EntityLivingBase entity, Random random); + + /** + * @param entity The entity instance being ground. + * @return Whether this entity has been fully processed or not. + */ + public boolean processEntity(EntityLivingBase entity); +} diff --git a/src/api/java/powercrystals/minefactoryreloaded/api/IFactoryHarvestable.java b/src/api/java/powercrystals/minefactoryreloaded/api/IFactoryHarvestable.java new file mode 100644 index 0000000..d4e620a --- /dev/null +++ b/src/api/java/powercrystals/minefactoryreloaded/api/IFactoryHarvestable.java @@ -0,0 +1,71 @@ +package powercrystals.minefactoryreloaded.api; + +import java.util.List; +import java.util.Map; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +/** + * @author PowerCrystals + * + * Defines a harvestable block for the Harvester. + */ +public interface IFactoryHarvestable +{ + /** + * @return The block this harvestable instance is managing. + */ + public Block getPlant(); + + /** + * @return The type of harvest the Harvester should perform on this block. + */ + public HarvestType getHarvestType(); + + /** + * @return Whether or not the Harvester should break the block when harvesting. If false, no changes will be performed by the Harvester itself. + */ + public boolean breakBlock(); + + /** + * @param world The world this block is in. + * @param harvesterSettings The harvester's current settings. Do not modify these. + * @param x The X coordinate of the block being harvested. + * @param y The Y coordinate of the block being harvested. + * @param z The Z coordinate of the block being harvested. + * @return True if this block can be harvested. + */ + public boolean canBeHarvested(World world, Map harvesterSettings, int x, int y, int z); + + /** + * @param world The world this block is in. + * @param rand A Random instance to use when generating drops. + * @param harvesterSettings The harvester's current settings. Do not modify these. + * @param x The X coordinate of the block being harvested. + * @param y The Y coordinate of the block being harvested. + * @param z The Z coordinate of the block being harvested. + * @return The drops generated by breaking this block. For a default implementation, calling Block.getBlockDropped() is usually sufficient. + */ + public List getDrops(World world, Random rand, Map harvesterSettings, int x, int y, int z); + + /** + * Called before the block is going to be harvested. Usually empty. + * @param world The world this block is in. + * @param x The X coordinate of the block being harvested. + * @param y The Y coordinate of the block being harvested. + * @param z The Z coordinate of the block being harvested. + */ + public void preHarvest(World world, int x, int y, int z); + + /** + * Called after the block is going to be harvested. Used to re-till soil, for example. + * @param world The world this block is in. + * @param x The X coordinate of the block being harvested. + * @param y The Y coordinate of the block being harvested. + * @param z The Z coordinate of the block being harvested. + */ + public void postHarvest(World world, int x, int y, int z); +} diff --git a/src/api/java/powercrystals/minefactoryreloaded/api/ILiquidDrinkHandler.java b/src/api/java/powercrystals/minefactoryreloaded/api/ILiquidDrinkHandler.java new file mode 100644 index 0000000..31eba00 --- /dev/null +++ b/src/api/java/powercrystals/minefactoryreloaded/api/ILiquidDrinkHandler.java @@ -0,0 +1,8 @@ +package powercrystals.minefactoryreloaded.api; + +import net.minecraft.entity.EntityLivingBase; + +public interface ILiquidDrinkHandler +{ + public void onDrink(EntityLivingBase player); +} diff --git a/src/api/java/powercrystals/minefactoryreloaded/api/MobDrop.java b/src/api/java/powercrystals/minefactoryreloaded/api/MobDrop.java new file mode 100644 index 0000000..7f5dd7c --- /dev/null +++ b/src/api/java/powercrystals/minefactoryreloaded/api/MobDrop.java @@ -0,0 +1,21 @@ +package powercrystals.minefactoryreloaded.api; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.WeightedRandom; + +public class MobDrop extends WeightedRandom.Item +{ + private ItemStack _stack; + + public MobDrop(int weight, ItemStack stack) + { + super(weight); + _stack = stack; + } + + public ItemStack getStack() + { + if(_stack == null) return null; + return _stack.copy(); + } +} diff --git a/src/api/java/powercrystals/minefactoryreloaded/api/ValuedItem.java b/src/api/java/powercrystals/minefactoryreloaded/api/ValuedItem.java new file mode 100644 index 0000000..3d075fa --- /dev/null +++ b/src/api/java/powercrystals/minefactoryreloaded/api/ValuedItem.java @@ -0,0 +1,72 @@ +package powercrystals.minefactoryreloaded.api; + +import net.minecraft.item.ItemStack; + +public class ValuedItem +{ + public final int value; + public final ItemStack item; + public final String key; + public final Object object; + + public ValuedItem(int v, ItemStack i) + { + value = v; + item = i; + key = null; + object = null; + } + + public ValuedItem(String v, Object i) + { + value = -1; + item = null; + key = v; + object = i; + } + + /** + * Presently unused but included so that if they do get used in the future, + * people including this in their jar and loading before MFR don't destroy everyone + */ + + public ValuedItem(int v, Object i) + { + value = v; + item = null; + key = null; + object = i; + } + + public ValuedItem(String v, ItemStack i) + { + value = -1; + item = i; + key = v; + object = null; + } + + public ValuedItem(int v, String k, ItemStack i) + { + value = v; + item = i; + key = k; + object = null; + } + + public ValuedItem(int v, String k, Object i) + { + value = v; + item = null; + key = k; + object = i; + } + + public ValuedItem(int v, String k, ItemStack i, Object o) + { + value = v; + item = i; + key = k; + object = o; + } +} diff --git a/src/api/java/thaumcraft/api/IGoggles.java b/src/api/java/thaumcraft/api/IGoggles.java new file mode 100644 index 0000000..2f53d81 --- /dev/null +++ b/src/api/java/thaumcraft/api/IGoggles.java @@ -0,0 +1,22 @@ +package thaumcraft.api; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; + +/** + * + * @author Azanor + * + * Equipped head slot items that extend this class will be able to perform most functions that + * goggles of revealing can apart from view nodes which is handled by IRevealer. + * + */ + +public interface IGoggles { + + /* + * If this method returns true things like block essentia contents will be shown. + */ + public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player); + +} -- cgit v1.2.3