Made it so that Demon Will will be voided if the player's tartaric gems are all full.
This commit is contained in:
parent
219b997b24
commit
eaba4e6cc2
|
@ -37,6 +37,33 @@ public class PlayerDemonWillHandler
|
||||||
return souls;
|
return souls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the player's Tartaric gems are completely full. If so, it will
|
||||||
|
* return true.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static boolean isDemonWillFull(EntityPlayer player)
|
||||||
|
{
|
||||||
|
ItemStack[] inventory = player.inventory.mainInventory;
|
||||||
|
|
||||||
|
for (int i = 0; i < inventory.length; i++)
|
||||||
|
{
|
||||||
|
ItemStack stack = inventory[i];
|
||||||
|
if (stack != null)
|
||||||
|
{
|
||||||
|
if (stack.getItem() instanceof IDemonWillGem)
|
||||||
|
{
|
||||||
|
if (((IDemonWillGem) stack.getItem()).getWill(stack) < ((IDemonWillGem) stack.getItem()).getMaxWill(stack))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package WayofTime.bloodmagic.item.soul;
|
package WayofTime.bloodmagic.item.soul;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
@ -94,7 +95,7 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon
|
||||||
{
|
{
|
||||||
NBTHelper.checkNBT(stack);
|
NBTHelper.checkNBT(stack);
|
||||||
|
|
||||||
tooltip.add(TextHelper.localizeEffect("tooltip.BloodMagic.sentientSword.desc"));
|
tooltip.addAll(Arrays.asList(TextHelper.cutLongString(TextHelper.localizeEffect("tooltip.BloodMagic.sentientSword.desc"))));
|
||||||
|
|
||||||
if (getActivated(stack))
|
if (getActivated(stack))
|
||||||
tooltip.add(TextHelper.localize("tooltip.BloodMagic.activated"));
|
tooltip.add(TextHelper.localize("tooltip.BloodMagic.activated"));
|
||||||
|
@ -155,7 +156,7 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon
|
||||||
|
|
||||||
for (int i = 0; i <= looting; i++)
|
for (int i = 0; i <= looting; i++)
|
||||||
{
|
{
|
||||||
if (i == 0 || attackingEntity.worldObj.rand.nextDouble() < 0.3)
|
if (i == 0 || attackingEntity.worldObj.rand.nextDouble() < 0.4)
|
||||||
{
|
{
|
||||||
ItemStack soulStack = soul.createWill(0, this.getDropOfActivatedSword(stack) * attackingEntity.worldObj.rand.nextDouble() + this.getStaticDropOfActivatedSword(stack));
|
ItemStack soulStack = soul.createWill(0, this.getDropOfActivatedSword(stack) * attackingEntity.worldObj.rand.nextDouble() + this.getStaticDropOfActivatedSword(stack));
|
||||||
soulList.add(soulStack);
|
soulList.add(soulStack);
|
||||||
|
|
|
@ -392,7 +392,7 @@ public class EventHandler
|
||||||
|
|
||||||
ItemStack remainder = PlayerDemonWillHandler.addDemonWill(player, stack);
|
ItemStack remainder = PlayerDemonWillHandler.addDemonWill(player, stack);
|
||||||
|
|
||||||
if (remainder == null || ((IDemonWill) stack.getItem()).getWill(stack) < 0.0001)
|
if (remainder == null || ((IDemonWill) stack.getItem()).getWill(stack) < 0.0001 || PlayerDemonWillHandler.isDemonWillFull(player))
|
||||||
{
|
{
|
||||||
stack.stackSize = 0;
|
stack.stackSize = 0;
|
||||||
event.setResult(Result.ALLOW);
|
event.setResult(Result.ALLOW);
|
||||||
|
|
Loading…
Reference in a new issue