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:
WayofTime 2021-01-17 15:19:34 -05:00
parent 99792acbb7
commit 7491ba5762

View file

@ -215,6 +215,8 @@ public class TileSoulForge extends TileInventory implements ITickableTileEntity,
currentOutputStack.grow(event.getOutput().getCount());
}
moveRemainingWillInConsumedInv();
consumeInventory();
}
}
@ -234,13 +236,16 @@ public class TileSoulForge extends TileInventory implements ITickableTileEntity,
public boolean hasSoulGemOrSoul()
{
ItemStack soulStack = getStackInSlot(soulSlot);
if (!soulStack.isEmpty())
for (int i = 0; i <= 4; i++)
{
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)
{
ItemStack soulStack = getStackInSlot(soulSlot);
if (soulStack != null)
double will = 0;
for (int i = 0; i <= 4; i++)
{
if (soulStack.getItem() instanceof IDemonWill && ((IDemonWill) soulStack.getItem()).getType(soulStack) == type)
{
IDemonWill soul = (IDemonWill) soulStack.getItem();
return soul.getWill(type, soulStack);
}
ItemStack soulStack = getStackInSlot(i);
if (soulStack.getItem() instanceof IDemonWillGem)
if (soulStack != null)
{
IDemonWillGem soul = (IDemonWillGem) soulStack.getItem();
return soul.getWill(type, soulStack);
if (soulStack.getItem() instanceof IDemonWill && ((IDemonWill) soulStack.getItem()).getType(soulStack) == type)
{
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)
{
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();
double souls = soul.drainWill(type, soulStack, requested);
if (soul.getWill(type, soulStack) <= 0)
if (soulStack.getItem() instanceof IDemonWill && ((IDemonWill) soulStack.getItem()).getType(soulStack) == type)
{
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 soul.drainWill(type, soulStack, requested, true);
return consumed;
}
}
return 0;
return consumed;
}
public void consumeInventory()