Reworked Tartaric Gems so that they contain specific demon will types (work for the future)
This commit is contained in:
parent
e681085d8b
commit
035ba94976
11 changed files with 142 additions and 76 deletions
|
@ -90,6 +90,7 @@ public class Constants
|
|||
public static final String SOUL_SWORD_ACTIVE_DRAIN = "soulSwordActiveDrain";
|
||||
public static final String SOUL_SWORD_DROP = "soulSwordDrop";
|
||||
public static final String SOUL_SWORD_STATIC_DROP = "soulSwordStaticDrop";
|
||||
public static final String WILL_TYPE = "demonWillType";
|
||||
|
||||
public static final String SOUL_FORGE_BURN = "burnTime";
|
||||
public static final String SOUL_FORGE_CONSUMED = "consumedSouls";
|
||||
|
|
|
@ -19,14 +19,12 @@ public interface IDemonWillGem
|
|||
* Returns the number of souls that are left in the soul gem. Returns a
|
||||
* double because souls can be fractionally drained.
|
||||
*
|
||||
* @param willGemStack
|
||||
* @return
|
||||
*/
|
||||
public double getWill(ItemStack willGemStack);
|
||||
public double getWill(EnumDemonWillType type, ItemStack willGemStack);
|
||||
|
||||
public void setWill(ItemStack willGemStack, double amount);
|
||||
public void setWill(EnumDemonWillType type, ItemStack willGemStack, double amount);
|
||||
|
||||
public int getMaxWill(ItemStack willGemStack);
|
||||
public int getMaxWill(EnumDemonWillType type, ItemStack willGemStack);
|
||||
|
||||
public double drainWill(ItemStack stack, double drainAmount);
|
||||
public double drainWill(EnumDemonWillType type, ItemStack stack, double drainAmount);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import net.minecraft.item.ItemStack;
|
|||
*/
|
||||
public class PlayerDemonWillHandler
|
||||
{
|
||||
public static double getTotalDemonWill(EntityPlayer player)
|
||||
public static double getTotalDemonWill(EnumDemonWillType type, EntityPlayer player)
|
||||
{
|
||||
ItemStack[] inventory = player.inventory.mainInventory;
|
||||
double souls = 0;
|
||||
|
@ -29,7 +29,7 @@ public class PlayerDemonWillHandler
|
|||
souls += ((IDemonWill) stack.getItem()).getWill(stack);
|
||||
} else if (stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
souls += ((IDemonWillGem) stack.getItem()).getWill(stack);
|
||||
souls += ((IDemonWillGem) stack.getItem()).getWill(type, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class PlayerDemonWillHandler
|
|||
* return true.
|
||||
*
|
||||
*/
|
||||
public static boolean isDemonWillFull(EntityPlayer player)
|
||||
public static boolean isDemonWillFull(EnumDemonWillType type, EntityPlayer player)
|
||||
{
|
||||
ItemStack[] inventory = player.inventory.mainInventory;
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class PlayerDemonWillHandler
|
|||
if (stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
hasGem = true;
|
||||
if (((IDemonWillGem) stack.getItem()).getWill(stack) < ((IDemonWillGem) stack.getItem()).getMaxWill(stack))
|
||||
if (((IDemonWillGem) stack.getItem()).getWill(type, stack) < ((IDemonWillGem) stack.getItem()).getMaxWill(type, stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class PlayerDemonWillHandler
|
|||
* @param amount
|
||||
* @return - amount consumed
|
||||
*/
|
||||
public static double consumeDemonWill(EntityPlayer player, double amount)
|
||||
public static double consumeDemonWill(EnumDemonWillType type, EntityPlayer player, double amount)
|
||||
{
|
||||
double consumed = 0;
|
||||
|
||||
|
@ -97,7 +97,7 @@ public class PlayerDemonWillHandler
|
|||
}
|
||||
} else if (stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
consumed += ((IDemonWillGem) stack.getItem()).drainWill(stack, amount - consumed);
|
||||
consumed += ((IDemonWillGem) stack.getItem()).drainWill(type, stack, amount - consumed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ public class PlayerDemonWillHandler
|
|||
return soulStack;
|
||||
}
|
||||
|
||||
public static double addDemonWill(EntityPlayer player, double amount)
|
||||
public static double addDemonWill(EnumDemonWillType type, EntityPlayer player, double amount)
|
||||
{
|
||||
ItemStack[] inventory = player.inventory.mainInventory;
|
||||
double remaining = amount;
|
||||
|
@ -154,9 +154,9 @@ public class PlayerDemonWillHandler
|
|||
{
|
||||
if (stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
double souls = ((IDemonWillGem) stack.getItem()).getWill(stack);
|
||||
double fill = Math.min(((IDemonWillGem) stack.getItem()).getMaxWill(stack) - souls, remaining);
|
||||
((IDemonWillGem) stack.getItem()).setWill(stack, fill + souls);
|
||||
double souls = ((IDemonWillGem) stack.getItem()).getWill(type, stack);
|
||||
double fill = Math.min(((IDemonWillGem) stack.getItem()).getMaxWill(type, stack) - souls, remaining);
|
||||
((IDemonWillGem) stack.getItem()).setWill(type, stack, fill + souls);
|
||||
remaining -= fill;
|
||||
|
||||
if (remaining <= 0)
|
||||
|
@ -170,7 +170,7 @@ public class PlayerDemonWillHandler
|
|||
return amount - remaining;
|
||||
}
|
||||
|
||||
public static double addDemonWill(EntityPlayer player, double amount, ItemStack ignored)
|
||||
public static double addDemonWill(EnumDemonWillType type, EntityPlayer player, double amount, ItemStack ignored)
|
||||
{
|
||||
ItemStack[] inventory = player.inventory.mainInventory;
|
||||
double remaining = amount;
|
||||
|
@ -182,9 +182,9 @@ public class PlayerDemonWillHandler
|
|||
{
|
||||
if (stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
double souls = ((IDemonWillGem) stack.getItem()).getWill(stack);
|
||||
double fill = Math.min(((IDemonWillGem) stack.getItem()).getMaxWill(stack) - souls, remaining);
|
||||
((IDemonWillGem) stack.getItem()).setWill(stack, fill + souls);
|
||||
double souls = ((IDemonWillGem) stack.getItem()).getWill(type, stack);
|
||||
double fill = Math.min(((IDemonWillGem) stack.getItem()).getMaxWill(type, stack) - souls, remaining);
|
||||
((IDemonWillGem) stack.getItem()).setWill(type, stack, fill + souls);
|
||||
remaining -= fill;
|
||||
|
||||
if (remaining <= 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue