Working on an Incense mechanic... You'll find out!

This commit is contained in:
WayofTime 2015-04-30 09:37:39 -04:00
parent b90db3857b
commit f1ebade718
7 changed files with 221 additions and 8 deletions

View file

@ -0,0 +1,20 @@
package WayofTime.alchemicalWizardry.api.sacrifice;
import net.minecraft.item.ItemStack;
public interface IIncense
{
public int getMinLevel(ItemStack stack);
public int getMaxLevel(ItemStack stack);
public int getIncenseDuration(ItemStack stack);
/**
* @param stack
* @return a float from 0 to 1
*/
public float getRedColour(ItemStack stack);
public float getGreenColour(ItemStack stack);
public float getBlueColour(ItemStack stack);
}

View file

@ -0,0 +1,36 @@
package WayofTime.alchemicalWizardry.api.sacrifice;
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
import net.minecraft.entity.player.EntityPlayer;
public class PlayerSacrificeHandler
{
public int getPlayerIncense(EntityPlayer player)
{
return APISpellHelper.getCurrentIncense(player);
}
public void setPlayerIncense(EntityPlayer player, int amount)
{
APISpellHelper.setCurrentIncense(player, amount);
}
public boolean incrementIncense(EntityPlayer player, int min, int max)
{
int amount = this.getPlayerIncense(player);
if(amount < min || amount >= max)
{
return false;
}
amount++;
return true;
}
public boolean sacrificePlayerHealth(EntityPlayer player)
{
return false;
}
}

View file

@ -42,6 +42,23 @@ public class APISpellHelper
return beaconData;
}
public static int getCurrentIncense(EntityPlayer player)
{
NBTTagCompound data = player.getEntityData();
if(data.hasKey("BM:CurrentIncense"))
{
return data.getInteger("BM:CurrentIncense");
}
return 0;
}
public static void setCurrentIncense(EntityPlayer player, int amount)
{
NBTTagCompound data = player.getEntityData();
data.setInteger("BM:CurrentIncense", amount);
}
public static int getPlayerLPTag(EntityPlayer player)
{
NBTTagCompound data = APISpellHelper.getPersistentDataTag(player);