Added Soulbound support for Baubles

* Includes Baubles API 1.0.1.10 (will not be included in ender io jar)
This commit is contained in:
HenryLoenwind committed 2015-03-19 01:29:04 +01:00
1 parent 9bbc87db50
commit 31c1c41c1b
6 files changed
+149

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
package baubles.api;
public enum BaubleType {
RING,
AMULET,
BELT
}
+41
View File
@@ -0,0 +1,41 @@
package baubles.api;
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
{
static Method getBaubles;
/**
* Retrieves the baubles inventory for the supplied player
*/
public static IInventory getBaubles(EntityPlayer player)
{
IInventory ot = null;
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)
{
FMLLog.warning("[Baubles API] Could not invoke baubles.common.lib.PlayerHandler method getPlayerBaubles");
}
return ot;
}
}
+45
View File
@@ -0,0 +1,45 @@
package baubles.api;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
/**
*
* 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.
* 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
*/
public void onUnequipped(ItemStack itemstack, EntityLivingBase player);
/**
* 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
*/
public boolean canUnequip(ItemStack itemstack, EntityLivingBase player);
}
@@ -0,0 +1,5 @@
@API(owner = "Baubles", apiVersion = "1.0.1.10", provides = "Baubles|API")
package baubles.api;
import cpw.mods.fml.common.API;