diff options
| author | Lance5057 <Lance5057@gmail.com> | 2015-01-27 19:27:30 -0600 |
|---|---|---|
| committer | Lance5057 <Lance5057@gmail.com> | 2015-01-27 19:27:30 -0600 |
| commit | c472007bbfa5e319e3e3967fb061875e000bb95e (patch) | |
| tree | 294bd85b20156e45a71014575ba1ea68fc1a7dc0 /src/api/java | |
| parent | 6925bf39ee227970c19b979806d52bf6a0ca5b3b (diff) | |
A whole mess of graphic updates
Diffstat (limited to 'src/api/java')
15 files changed, 655 insertions, 0 deletions
diff --git a/src/api/java/cofh/core/item/IEqualityOverrideItem.java b/src/api/java/cofh/core/item/IEqualityOverrideItem.java new file mode 100644 index 0000000..c2dc3ac --- /dev/null +++ b/src/api/java/cofh/core/item/IEqualityOverrideItem.java @@ -0,0 +1,9 @@ +package cofh.core.item; + +import net.minecraft.item.ItemStack; + +public interface IEqualityOverrideItem { + + public boolean isLastHeldItemEqual(ItemStack current, ItemStack previous); + +}
\ No newline at end of file diff --git a/src/api/java/exterminatorJeff/undergroundBiomes/api/UBAPIHook.java b/src/api/java/exterminatorJeff/undergroundBiomes/api/UBAPIHook.java new file mode 100644 index 0000000..13279ef --- /dev/null +++ b/src/api/java/exterminatorJeff/undergroundBiomes/api/UBAPIHook.java @@ -0,0 +1,11 @@ +package exterminatorJeff.undergroundBiomes.api; + +/** + * Striped down version, get the full API from here: https://github.com/Zeno410/UndergroundBiomes1.7API + * @author Zeno410 + */ +public class UBAPIHook { + public static final UBAPIHook ubAPIHook = new UBAPIHook(); + //public UBDimensionalStrataColumnProvider dimensionalStrataColumnProvider; // set in the main Underground Biomes + public UBOreTexturizer ubOreTexturizer; +} diff --git a/src/api/java/exterminatorJeff/undergroundBiomes/api/UBOreTexturizer.java b/src/api/java/exterminatorJeff/undergroundBiomes/api/UBOreTexturizer.java new file mode 100644 index 0000000..947b156 --- /dev/null +++ b/src/api/java/exterminatorJeff/undergroundBiomes/api/UBOreTexturizer.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package exterminatorJeff.undergroundBiomes.api; + +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import net.minecraft.block.Block; +import net.minecraft.world.World; + +/** + * Striped down version, get the full API from here: https://github.com/Zeno410/UndergroundBiomes1.7API + * This is an interface for the class that can create Underground Biomes versions of arbitary ores + * It creates three new blocks for each texturized ore. + * @author Zeno410 + */ +public interface UBOreTexturizer { + // usage: Block is the ore block. + // Overlay name is the fully qualified name, e.g. modname:overlayName + // that static vars are fully qualified names for all the textures in the UB pack, just pass as is + // the event isn't needed per se, but if this is called anytime else, the blocks will not "stick" + public void setupUBOre(Block oreBlock, String overlayName, FMLPreInitializationEvent event); + public void setupUBOre(Block oreBlock, int metadata, String overlayName, FMLPreInitializationEvent event); + public void setupUBOre(Block oreBlock, int metadata, String overlayName, String blockName, FMLPreInitializationEvent event); + + public void requestUBOreSetup(Block oreBlock, String overlayName) throws BlocksAreAlreadySet; + public void requestUBOreSetup(Block oreBlock, int metadata, String overlayName) throws BlocksAreAlreadySet; + public void requestUBOreSetup(Block oreBlock, int metadata, String overlayName, String blockName) throws BlocksAreAlreadySet; + public void redoOres(int xInBlockCoordinates, int zInBlockCoordinates, World serverSideWorld) ; + + public static String amber_overlay = "undergroundbiomes:amber_overlay"; + public static String cinnabar_overlay = "undergroundbiomes:cinnabar_overlay"; + public static String coal_overlay = "undergroundbiomes:coal_overlay"; + public static String copper_overlay = "undergroundbiomes:copper_overlay"; + public static String diamond_overlay = "undergroundbiomes:diamond_overlay"; + public static String emerald_overlay = "undergroundbiomes:emerald_overlay"; + public static String gold_overlay = "undergroundbiomes:gold_overlay"; + public static String iron_overlay = "undergroundbiomes:iron_overlay"; + public static String lapis_overlay = "undergroundbiomes:lapis_overlay"; + public static String lead_overlay = "undergroundbiomes:lead_overlay"; + public static String olivine_peridot_overlay = "undergroundbiomes:olivine-peridot_overlay"; + public static String redstone_overlay = "undergroundbiomes:redstone_overlay"; + public static String ruby_overlay = "undergroundbiomes:ruby_overlay"; + public static String sapphire_overlay = "undergroundbiomes:sapphire_overlay"; + public static String tin_overlay = "undergroundbiomes:tin_overlay"; + public static String uranium_overlay = "undergroundbiomes:uranium_overlay"; + + public class BlocksAreAlreadySet extends RuntimeException { + // this is thrown if UB has already run its pre-initialization step and can no longer register blocks + public final Block oreBlock; + public final String overlayName; + + public BlocksAreAlreadySet(Block oreBlock, String overlayName) { + this.oreBlock = oreBlock; + this.overlayName = overlayName; + } + + @Override + public String toString() { + String blockDescription = "undefined block"; + String overlayDescription = "undefined overlay"; + if (oreBlock != null) blockDescription = oreBlock.getUnlocalizedName(); + if (overlayName != null) overlayDescription = overlayName; + return "Attempt to create Underground Biomes ore for "+blockDescription+" with "+overlayDescription + + " after blocks have already been defined"; + } + + } +} diff --git a/src/api/java/mods/battlegear2/api/IAllowItem.java b/src/api/java/mods/battlegear2/api/IAllowItem.java new file mode 100644 index 0000000..78e9ffa --- /dev/null +++ b/src/api/java/mods/battlegear2/api/IAllowItem.java @@ -0,0 +1,11 @@ +package mods.battlegear2.api; + +import net.minecraft.item.ItemStack; + +public interface IAllowItem { + + /** + * Returns true if the mainhand {@link ItemStack} allows the offhand {@link ItemStack} to be placed in the partner offhand slot + */ + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand); +} diff --git a/src/api/java/mods/battlegear2/api/IOffhandDual.java b/src/api/java/mods/battlegear2/api/IOffhandDual.java new file mode 100644 index 0000000..4e93dd5 --- /dev/null +++ b/src/api/java/mods/battlegear2/api/IOffhandDual.java @@ -0,0 +1,62 @@ +package mods.battlegear2.api; + +import cpw.mods.fml.relauncher.Side; +import net.minecraft.item.ItemStack; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; + +public interface IOffhandDual { + /** + * Returns true if this item can be dual wielded in the offhand slot + * @param off The {@link ItemStack} holding this item + */ + public boolean isOffhandHandDual(ItemStack off); + + /** + * Perform any function when this item is held in the offhand and the user right clicks an entity. + * This is generally used to attack an entity with the offhand item. + * If this is the case the {@link PlayerEventChild.OffhandAttackEvent#parent} field should + * be canceled (or {@link PlayerEventChild.OffhandAttackEvent#cancelParent} field left at true, to prevent any default right clicking events (Eg Villager Trading) + * + * @param event the OffhandAttackEvent that was generated + * @param mainhandItem the {@link ItemStack} currently being held in the right hand + * @param offhandItem the {@link ItemStack} currently being held in the left hand, holding this item + * @return true if the off hand swing animation should be performed + */ + public boolean offhandAttackEntity(PlayerEventChild.OffhandAttackEvent event, ItemStack mainhandItem, ItemStack offhandItem); + + /** + * Perform any function when this item is held in the offhand and the user right clicks "Air". + * Note: Called first on client-side, then on server side if {@link PlayerInteractEvent} is not cancelled and mainhandItem is not null, + * following Forge rules for PlayerInteractEvent with Action==RIGHT_CLICK_AIR + * Note: PlayerInteractEvent is already cancelled beforehand, and will be cancelled after if this method returns false + * Note: Above issues will be fixed in next Minecraft versions by replacing first arg with a shallow copy + * @param event the PlayerInteractEvent that was generated + * @param mainhandItem the {@link ItemStack} currently being held in the right hand + * @param offhandItem the {@link ItemStack} currently being held in the left hand, holding this item + * @return true if the off hand swing animation should be performed + */ + public boolean offhandClickAir(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem); + + /** + * Perform any function when this item is held in the offhand and the user right clicks a block. + * Note: this will happen prior to the activation of any activation functions of blocks + * Note: Called first on client-side, then on server side if {@link PlayerInteractEvent} is not cancelled + * Note: {@link PlayerInteractEvent#useItem} is already set on {@link Event.Result#DENY} before reaching this method, in order to avoid mainhandItem usage + * + * @param event the PlayerInteractEvent that was generated + * @param mainhandItem the {@link ItemStack} currently being held in the right hand + * @param offhandItem the {@link ItemStack} currently being held in the left hand, holding this item + * @return true if the off hand swing animation should be performed + */ + public boolean offhandClickBlock(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem); + + @SuppressWarnings("unused") + /** + * Perform any passive effects on each game tick when this item is held in the offhand + * @deprecated See {@link Item#onUpdate(ItemStack, World, Entity, int, boolean)} + * @param effectiveSide the effective side the method was called from + * @param mainhandItem the {@link ItemStack} currently being held in the right hand + * @param offhandItem the {@link ItemStack} currently being held in the left hand + */ + public void performPassiveEffects(Side effectiveSide, ItemStack mainhandItem, ItemStack offhandItem); +} diff --git a/src/api/java/mods/battlegear2/api/ISheathed.java b/src/api/java/mods/battlegear2/api/ISheathed.java new file mode 100644 index 0000000..411c639 --- /dev/null +++ b/src/api/java/mods/battlegear2/api/ISheathed.java @@ -0,0 +1,20 @@ +package mods.battlegear2.api; + +import net.minecraft.item.ItemStack; + +/** + * When a {@link net.minecraft.entity.player.EntityPlayer} is not in "battlemode", the {@link ItemStack}s stored in Battlegear additional slots + * and previously selected are displayed, either on the back (slightly moved depending on armor) or on the hip (opposite side to the hand slot it is stored in) + * Note:Default behavior is dependent on Battlegear configuration + * This interface can be implemented in a {@link net.minecraft.item.Item} instance to decide where to actually render it + * See {@link mods.battlegear2.api.RenderPlayerEventChild.PreRenderSheathed} and {@link mods.battlegear2.api.RenderPlayerEventChild.PostRenderSheathed} + * for more flexibility over the rendering + */ +public interface ISheathed { + + /** + * Returns true if this item should always be sheathed on the back, false if it should be sheathed on the hip + * @param item the {@link ItemStack} to be sheathed + */ + public boolean sheatheOnBack(ItemStack item); +} diff --git a/src/api/java/mods/battlegear2/api/PlayerEventChild.java b/src/api/java/mods/battlegear2/api/PlayerEventChild.java new file mode 100644 index 0000000..95ea329 --- /dev/null +++ b/src/api/java/mods/battlegear2/api/PlayerEventChild.java @@ -0,0 +1,271 @@ +package mods.battlegear2.api; + +import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.player.ArrowLooseEvent; +import net.minecraftforge.event.entity.player.EntityInteractEvent; +import net.minecraftforge.event.entity.player.PlayerEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; + +public abstract class PlayerEventChild extends PlayerEvent{ + + /** + * The event that this event is a child of + */ + public final PlayerEvent parent; + + public PlayerEventChild(PlayerEvent parent) { + super(parent.entityPlayer); + this.parent = parent; + } + + public void setCancelParentEvent(boolean cancel) { + parent.setCanceled(cancel); + } + + @Override + public void setCanceled(boolean cancel) { + super.setCanceled(cancel); + parent.setCanceled(cancel); + } + + @Override + public void setResult(Result value) { + super.setResult(value); + parent.setResult(value); + } + + public EntityPlayer getPlayer(){ + return parent.entityPlayer; + } + + /** + * Event fired when a shield successfully blocks an attack (in {@link LivingHurtEvent}) + */ + public static class ShieldBlockEvent extends PlayerEventChild { + public final ItemStack shield; + public final DamageSource source; + public final float ammount; // use same name as other Forge events + public float ammountRemaining = 0.0F; // damage remaining after shield block event, if any + /** + * If the {@link IShield#blockAnimation(EntityPlayer, float)} should be called + */ + public boolean performAnimation = true; + /** + * If the shield should be damaged based on the ammount and the result of {@link IShield#getDamageReduction(ItemStack, DamageSource)} + */ + public boolean damageShield = true; + public ShieldBlockEvent(PlayerEvent parent, ItemStack shield, DamageSource source, float ammount) { + super(parent); + this.shield = shield; + this.source = source; + this.ammount = ammount; + } + } + + /** + * Called when a player right clicks in battlemode + * The parent event can be either {@link PlayerInteractEvent} or {@link EntityInteractEvent} if the OffhandAttackEvent allowed swinging + * Both {@link ItemStack} can be null + * If cancelled, no offhand swinging will be performed + */ + @Cancelable + public static class OffhandSwingEvent extends PlayerEventChild { + public final ItemStack mainHand; + public final ItemStack offHand; + public OffhandSwingEvent(PlayerEvent parent, ItemStack mainHand, ItemStack offHand){ + super(parent); + this.mainHand = mainHand; + this.offHand = offHand; + } + } + + /** + * Called when a player right clicks an entity in battlemode + * Both {@link ItemStack} can be null + * Cancelling will prevent any further processing and prevails over the boolean fields + */ + @Cancelable + public static class OffhandAttackEvent extends PlayerEventChild { + + /** + * If we should call the OffhandSwingEvent and perform swinging + */ + public boolean swingOffhand = true; + /** + * If we should perform an attack on the entity with the offhand item + * Note: Will post {@link AttackEntityEvent} and {@link Item#onLeftClickEntity(ItemStack, EntityPlayer, Entity)} + * with {@link InventoryPlayer#currentItem} offset to the offhand + */ + public boolean shouldAttack = true; + /** + * If we should cancel the base entity interaction event + */ + public boolean cancelParent = true; + /** + * The base entity interaction event + */ + public final EntityInteractEvent event; + /** + * Content of the main hand slot + */ + public final ItemStack mainHand; + /** + * Content of the off hand slot + */ + public final ItemStack offHand; + + public OffhandAttackEvent(EntityInteractEvent parent, ItemStack mainHand, ItemStack offHand) { + super(parent); + this.event = parent; + this.mainHand = mainHand; + this.offHand = offHand; + } + + public Entity getTarget() { + return ((EntityInteractEvent)parent).target; + } + } + + /** + * This event replicates the event usage of {@link PlayerInteractEvent} for the item in left hand on right click, + * allowing support for other mods that use such event to customize item usage + * {@link Item#onItemUseFirst}, {@link Item#onItemRightClick} and {@link Item#onItemUse} will then get called the same way as with the item in the player right hand for PlayerInteractEvent + */ + @Cancelable + public static class UseOffhandItemEvent extends PlayerEventChild{ + /** + * The {@link ItemStack} held in left hand + */ + public final ItemStack offhand; + /** + * The equivalent {@link PlayerInteractEvent} that would have been triggered if the offhand item was held in right hand and right click was pressed + */ + public final PlayerInteractEvent event; + public UseOffhandItemEvent(PlayerInteractEvent event, ItemStack offhand){ + super(event); + this.event = event; + this.offhand = offhand; + } + } + + public static class QuiverArrowEvent extends PlayerEventChild{ + /** + * The event from which this occurred + */ + protected final ArrowLooseEvent event; + public QuiverArrowEvent(ArrowLooseEvent event){ + super(event); + this.event = event; + } + + /** + * @return the player using the bow + */ + public EntityPlayer getArcher(){ + return getPlayer(); + } + + /** + * @return the bow trying to fire + */ + public ItemStack getBow() + { + return event.bow; + } + + /** + * @return the amount of charge in the bow + */ + public float getCharge() + { + return event.charge; + } + + /** + * Event fired after an arrow has been selected and taken from a {@link IArrowContainer2}, before it is actually spawned + */ + @Cancelable + public static class Firing extends QuiverArrowEvent { + /** + * Damage done to the bow after arrow is fired + */ + public int bowDamage = 1; + /** + * The volume of the sound emitted from the bow after arrow is fired + */ + public float bowSoundVolume = 1.0F; + /** + * Decides if standard enchantments can be added to the arrow + */ + public boolean addEnchantments = true; + /** + * Decides if critical state should be forced into the arrow + */ + public boolean isCritical = false; + /** + * The quiver from which the arrow was pulled from + */ + public final ItemStack quiver; + /** + * The arrow to be fired, can't be null + */ + public final EntityArrow arrow; + + public Firing(ArrowLooseEvent parent, ItemStack quiver, EntityArrow arrow) { + super(parent); + this.quiver = quiver; + this.arrow = arrow; + } + + } + + /** + * The DEFAULT result for this event is the vanilla charge calculated value + * Use setNewCharge to override the value with the one provided + * Change the event result to DENY to prevent further processing + */ + @HasResult + public static class ChargeCalculations extends QuiverArrowEvent { + /** + * Returned value if the result is set to allow + */ + protected float charge; + public ChargeCalculations(ArrowLooseEvent event){ + super(event); + } + + @Override + public float getCharge(){ + MinecraftForge.EVENT_BUS.post(this); + switch (this.getResult()){ + case ALLOW: + return charge; + case DENY: + return 0; + } + float f = super.getCharge()/20.0F; + f = (f * f + f * 2.0F) / 3.0F; + if ((double)f < 0.1D) + { + return 0; + } + if (f > 1.0F) + { + f = 1.0F; + } + return f; + } + + public void setNewCharge(float charge){ + this.setResult(Result.ALLOW); + this.charge = charge; + } + } + } +} diff --git a/src/api/java/mods/battlegear2/api/package-info.java b/src/api/java/mods/battlegear2/api/package-info.java new file mode 100644 index 0000000..49f47ea --- /dev/null +++ b/src/api/java/mods/battlegear2/api/package-info.java @@ -0,0 +1,4 @@ +@API(owner = "battlegear2", provides = "DualWield", apiVersion = "0.1") +package mods.battlegear2.api; + +import cpw.mods.fml.common.API;
\ No newline at end of file diff --git a/src/api/java/mods/battlegear2/api/weapons/IBattlegearWeapon.java b/src/api/java/mods/battlegear2/api/weapons/IBattlegearWeapon.java new file mode 100644 index 0000000..8442153 --- /dev/null +++ b/src/api/java/mods/battlegear2/api/weapons/IBattlegearWeapon.java @@ -0,0 +1,13 @@ +package mods.battlegear2.api.weapons; + +import mods.battlegear2.api.IAllowItem; +import mods.battlegear2.api.IOffhandDual; +import mods.battlegear2.api.ISheathed; + +/** + * A generic flag for weapon + * <strong>Not</strong> necessary for an item to be wielded in battlegear slots + */ +public interface IBattlegearWeapon extends ISheathed,IOffhandDual,IAllowItem{ + +}
\ No newline at end of file diff --git a/src/api/java/mods/battlegear2/api/weapons/package-info.java b/src/api/java/mods/battlegear2/api/weapons/package-info.java new file mode 100644 index 0000000..2e3232b --- /dev/null +++ b/src/api/java/mods/battlegear2/api/weapons/package-info.java @@ -0,0 +1,4 @@ +@API(owner = "battlegear2", provides = "Weapons", apiVersion = "0.1") +package mods.battlegear2.api.weapons; + +import cpw.mods.fml.common.API;
\ No newline at end of file diff --git a/src/api/java/modwarriors/notenoughkeys/api/Api.java b/src/api/java/modwarriors/notenoughkeys/api/Api.java new file mode 100644 index 0000000..390d28a --- /dev/null +++ b/src/api/java/modwarriors/notenoughkeys/api/Api.java @@ -0,0 +1,40 @@ +package modwarriors.notenoughkeys.api; + +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/** + * Center of the API. Main api methods can be found in this class. + * + * @author TheTemportalist + */ +@SideOnly(Side.CLIENT) +public class Api { + + /** + * Checks if NotEnoughKeys is loaded in the current environment + * + * @return 'true' if loaded + */ + public static boolean isLoaded() { + return Loader.isModLoaded("notenoughkeys"); + } + + /** + * Registers a mod's keys with NEK + * + * @param modname The NAME of the mod registering the key + * @param keyDecriptions A String[] (Array[String]) of the key descriptions. i.e. new String[]{"key.hotbar1"} + */ + public static void registerMod(String modname, String[] keyDecriptions) { + try { + Class.forName("modwarriors.notenoughkeys.keys.KeyHelper").getMethod( + "registerMod", String.class, String[].class + ).invoke(null, modname, keyDecriptions); + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/src/api/java/modwarriors/notenoughkeys/api/KeyBindingPressedEvent.java b/src/api/java/modwarriors/notenoughkeys/api/KeyBindingPressedEvent.java new file mode 100644 index 0000000..d17b808 --- /dev/null +++ b/src/api/java/modwarriors/notenoughkeys/api/KeyBindingPressedEvent.java @@ -0,0 +1,43 @@ +package modwarriors.notenoughkeys.api; + +import cpw.mods.fml.common.eventhandler.Cancelable; +import cpw.mods.fml.common.eventhandler.Event; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.settings.KeyBinding; + +/** + * Called when a keybinding is triggered with the passed with valid modifiers + * + * @author TheTemportalist + */ +@SideOnly(Side.CLIENT) +@Cancelable +public class KeyBindingPressedEvent extends Event { + + /** + * The KeyBinding being triggered + */ + public KeyBinding keyBinding = null; + /** + * Tells whether a modifier was required AND was down when triggered + */ + public boolean shiftRequired = false, ctrlRequired = false, altRequired = false; + + /** + * Called with the passed keyBinding and modifiers. + * Subscribe to this event so activate a keybinding when triggered. + * + * @param keyBinding The KeyBinding being triggered. Stores the key's description and keycode + * @param modifiers The modifiers (SHIFT, CTRL, ALT) that determine when a compatible key is pressed + */ + public KeyBindingPressedEvent(KeyBinding keyBinding, boolean[] modifiers) { + super(); + this.keyBinding = keyBinding; + this.shiftRequired = modifiers[0]; + this.ctrlRequired = modifiers[1]; + this.altRequired = modifiers[2]; + + } + +} diff --git a/src/api/java/modwarriors/notenoughkeys/api/package-info.java b/src/api/java/modwarriors/notenoughkeys/api/package-info.java new file mode 100644 index 0000000..d53b000 --- /dev/null +++ b/src/api/java/modwarriors/notenoughkeys/api/package-info.java @@ -0,0 +1,5 @@ + +@API(owner = "Not Enough Keys", provides = "API_NEK", + apiVersion = "1.0.0") package modwarriors.notenoughkeys.api; + +import cpw.mods.fml.common.API; diff --git a/src/api/java/thaumcraft/api/ItemApi.java b/src/api/java/thaumcraft/api/ItemApi.java new file mode 100644 index 0000000..25dda28 --- /dev/null +++ b/src/api/java/thaumcraft/api/ItemApi.java @@ -0,0 +1,70 @@ +package thaumcraft.api; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.common.FMLLog; + +/** + * @author Azanor + * + * This is used to gain access to the items in my mod. + * I only give some examples and it will probably still + * require a bit of work for you to get hold of everything you need. + * + */ +public class ItemApi { + + public static ItemStack getItem(String itemString, int meta) { + ItemStack item = null; + + try { + String itemClass = "thaumcraft.common.config.ConfigItems"; + Object obj = Class.forName(itemClass).getField(itemString).get(null); + if (obj instanceof Item) { + item = new ItemStack((Item) obj,1,meta); + } else if (obj instanceof ItemStack) { + item = (ItemStack) obj; + } + } catch (Exception ex) { + FMLLog.warning("[Thaumcraft] Could not retrieve item identified by: " + itemString); + } + + return item; + } + + public static ItemStack getBlock(String itemString, int meta) { + ItemStack item = null; + + try { + String itemClass = "thaumcraft.common.config.ConfigBlocks"; + Object obj = Class.forName(itemClass).getField(itemString).get(null); + if (obj instanceof Block) { + item = new ItemStack((Block) obj,1,meta); + } else if (obj instanceof ItemStack) { + item = (ItemStack) obj; + } + } catch (Exception ex) { + FMLLog.warning("[Thaumcraft] Could not retrieve block identified by: " + itemString); + } + + return item; + } + + /** + * + * Some examples + * + * Casting Wands: + * itemWandCasting + * + * Resources: + * itemEssence, itemWispEssence, itemResource, itemShard, itemNugget, + * itemNuggetChicken, itemNuggetBeef, itemNuggetPork, itemTripleMeatTreat + * + * Research: + * itemResearchNotes, itemInkwell, itemThaumonomicon + * + */ + +} diff --git a/src/api/java/thaumcraft/api/nodes/IRevealer.java b/src/api/java/thaumcraft/api/nodes/IRevealer.java new file mode 100644 index 0000000..14a19b5 --- /dev/null +++ b/src/api/java/thaumcraft/api/nodes/IRevealer.java @@ -0,0 +1,22 @@ +package thaumcraft.api.nodes; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; + +/** + * + * @author Azanor + * + * Equipped head slot items that extend this class will make nodes visible in world. + * + */ + +public interface IRevealer { + + /* + * If this method returns true the nodes will be visible. + */ + public boolean showNodes(ItemStack itemstack, EntityLivingBase player); + + +} |
