Changed the Hellfire Forge so that it can use the Tartaric Gem in the crafting grid, and moves the remaining Will into the crafted gem
This commit is contained in:
parent
99792acbb7
commit
7491ba5762
|
@ -215,6 +215,8 @@ public class TileSoulForge extends TileInventory implements ITickableTileEntity,
|
||||||
currentOutputStack.grow(event.getOutput().getCount());
|
currentOutputStack.grow(event.getOutput().getCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
moveRemainingWillInConsumedInv();
|
||||||
|
|
||||||
consumeInventory();
|
consumeInventory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,13 +236,16 @@ public class TileSoulForge extends TileInventory implements ITickableTileEntity,
|
||||||
|
|
||||||
public boolean hasSoulGemOrSoul()
|
public boolean hasSoulGemOrSoul()
|
||||||
{
|
{
|
||||||
ItemStack soulStack = getStackInSlot(soulSlot);
|
for (int i = 0; i <= 4; i++)
|
||||||
|
|
||||||
if (!soulStack.isEmpty())
|
|
||||||
{
|
{
|
||||||
if (soulStack.getItem() instanceof IDemonWill || soulStack.getItem() instanceof IDemonWillGem)
|
ItemStack soulStack = getStackInSlot(i);
|
||||||
|
|
||||||
|
if (!soulStack.isEmpty())
|
||||||
{
|
{
|
||||||
return true;
|
if (soulStack.getItem() instanceof IDemonWill || soulStack.getItem() instanceof IDemonWillGem)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,51 +259,96 @@ public class TileSoulForge extends TileInventory implements ITickableTileEntity,
|
||||||
|
|
||||||
public double getWill(EnumDemonWillType type)
|
public double getWill(EnumDemonWillType type)
|
||||||
{
|
{
|
||||||
ItemStack soulStack = getStackInSlot(soulSlot);
|
double will = 0;
|
||||||
|
for (int i = 0; i <= 4; i++)
|
||||||
if (soulStack != null)
|
|
||||||
{
|
{
|
||||||
if (soulStack.getItem() instanceof IDemonWill && ((IDemonWill) soulStack.getItem()).getType(soulStack) == type)
|
ItemStack soulStack = getStackInSlot(i);
|
||||||
{
|
|
||||||
IDemonWill soul = (IDemonWill) soulStack.getItem();
|
|
||||||
return soul.getWill(type, soulStack);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (soulStack.getItem() instanceof IDemonWillGem)
|
if (soulStack != null)
|
||||||
{
|
{
|
||||||
IDemonWillGem soul = (IDemonWillGem) soulStack.getItem();
|
if (soulStack.getItem() instanceof IDemonWill && ((IDemonWill) soulStack.getItem()).getType(soulStack) == type)
|
||||||
return soul.getWill(type, soulStack);
|
{
|
||||||
|
IDemonWill soul = (IDemonWill) soulStack.getItem();
|
||||||
|
will += soul.getWill(type, soulStack);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (soulStack.getItem() instanceof IDemonWillGem)
|
||||||
|
{
|
||||||
|
IDemonWillGem soul = (IDemonWillGem) soulStack.getItem();
|
||||||
|
will += soul.getWill(type, soulStack);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return will;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void moveRemainingWillInConsumedInv()
|
||||||
|
{
|
||||||
|
ItemStack outputStack = getStackInSlot(outputSlot);
|
||||||
|
if (outputStack != null)
|
||||||
|
{
|
||||||
|
if (outputStack.getItem() instanceof IDemonWillGem)
|
||||||
|
{
|
||||||
|
IDemonWillGem filledGem = (IDemonWillGem) outputStack.getItem();
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
ItemStack soulStack = getStackInSlot(i);
|
||||||
|
if (soulStack != null && soulStack.getItem() instanceof IDemonWillGem)
|
||||||
|
{
|
||||||
|
IDemonWillGem syphonedGem = (IDemonWillGem) soulStack.getItem();
|
||||||
|
for (EnumDemonWillType type : EnumDemonWillType.values())
|
||||||
|
{
|
||||||
|
// Skipped a few possibly redundant checks. Also could blow up in my face rooVV
|
||||||
|
double willInGem = syphonedGem.getWill(type, soulStack);
|
||||||
|
if (willInGem > 0)
|
||||||
|
{
|
||||||
|
filledGem.fillWill(type, outputStack, willInGem, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double consumeSouls(EnumDemonWillType type, double requested)
|
public double consumeSouls(EnumDemonWillType type, double requested)
|
||||||
{
|
{
|
||||||
ItemStack soulStack = getStackInSlot(soulSlot);
|
double consumed = 0;
|
||||||
|
|
||||||
if (soulStack != null)
|
for (int i = 0; i <= 4; i++)
|
||||||
{
|
{
|
||||||
if (soulStack.getItem() instanceof IDemonWill && ((IDemonWill) soulStack.getItem()).getType(soulStack) == type)
|
ItemStack soulStack = getStackInSlot(i);
|
||||||
|
if (soulStack != null)
|
||||||
{
|
{
|
||||||
IDemonWill soul = (IDemonWill) soulStack.getItem();
|
if (soulStack.getItem() instanceof IDemonWill && ((IDemonWill) soulStack.getItem()).getType(soulStack) == type)
|
||||||
double souls = soul.drainWill(type, soulStack, requested);
|
|
||||||
if (soul.getWill(type, soulStack) <= 0)
|
|
||||||
{
|
{
|
||||||
setInventorySlotContents(soulSlot, ItemStack.EMPTY);
|
IDemonWill soul = (IDemonWill) soulStack.getItem();
|
||||||
|
double souls = soul.drainWill(type, soulStack, requested - consumed);
|
||||||
|
if (soul.getWill(type, soulStack) <= 0)
|
||||||
|
{
|
||||||
|
setInventorySlotContents(i, ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
consumed += souls;
|
||||||
|
// return souls;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (soulStack.getItem() instanceof IDemonWillGem)
|
||||||
|
{
|
||||||
|
IDemonWillGem soul = (IDemonWillGem) soulStack.getItem();
|
||||||
|
double souls = soul.drainWill(type, soulStack, requested - consumed, true);
|
||||||
|
consumed += souls;
|
||||||
}
|
}
|
||||||
return souls;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (soulStack.getItem() instanceof IDemonWillGem)
|
if (consumed >= requested)
|
||||||
{
|
{
|
||||||
IDemonWillGem soul = (IDemonWillGem) soulStack.getItem();
|
return consumed;
|
||||||
return soul.drainWill(type, soulStack, requested, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return consumed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void consumeInventory()
|
public void consumeInventory()
|
||||||
|
|
Loading…
Reference in a new issue