Fixed #719 and updated libs

This commit is contained in:
Katrina Swales committed 2015-04-13 23:28:45 +02:00
1 parent 547df8eff0
commit ecda071df8
5 files changed
+50 -49

No files matched your search

+20 -13
View File
@@ -1,34 +1,41 @@
package baubles.api;
import cpw.mods.fml.common.FMLLog;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import java.lang.reflect.Method;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import cpw.mods.fml.common.FMLLog;
/**
* @author Azanor
*/
public class BaublesApi {
public class BaublesApi
{
static Method getBaubles;
/**
* Retrieves the baubles inventory for the supplied player
*/
public static IInventory getBaubles(EntityPlayer player) {
public static IInventory getBaubles(EntityPlayer player)
{
IInventory ot = null;
try {
if(getBaubles == null) {
Class fake = Class.forName("baubles.common.lib.PlayerHandler");
try
{
if(getBaubles == null)
{
Class<?> fake = Class.forName("baubles.common.lib.PlayerHandler");
getBaubles = fake.getMethod("getPlayerBaubles", EntityPlayer.class);
}
ot = (IInventory) getBaubles.invoke(null, player);
} catch(Exception ex) {
}
catch(Exception ex)
{
FMLLog.warning("[Baubles API] Could not invoke baubles.common.lib.PlayerHandler method getPlayerBaubles");
}
return ot;
}
}
+9 -10
View File
@@ -4,31 +4,30 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
/**
*
* @author Azanor
*
*
* This interface should be extended by items that can be worn in bauble slots
*
*
* @author Azanor
*/
public interface IBauble {
/**
* This method return the type of bauble this is.
* This method return the type of bauble this is.
* Type is used to determine the slots it can go into.
*/
public BaubleType getBaubleType(ItemStack itemstack);
/**
* This method is called once per tick if the bauble is being worn by a player
*/
public void onWornTick(ItemStack itemstack, EntityLivingBase player);
/**
* This method is called when the bauble is equipped by a player
*/
public void onEquipped(ItemStack itemstack, EntityLivingBase player);
/**
* This method is called when the bauble is unequipped by a player
*/
@@ -38,7 +37,7 @@ public interface IBauble {
* can this bauble be placed in a bauble slot
*/
public boolean canEquip(ItemStack itemstack, EntityLivingBase player);
/**
* Can this bauble be removed from a bauble slot
*/
@@ -0,0 +1,5 @@
@API(owner = "Baubles", apiVersion = "1.0.1.10", provides = "Baubles|API")
package baubles.api;
import cpw.mods.fml.common.API;