Fixed Portal ritual.
This commit is contained in:
parent
7979dc4e5f
commit
34a9b5a7ec
8 changed files with 151 additions and 45 deletions
|
@ -9,10 +9,12 @@ import net.minecraft.util.ITickable;
|
|||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.recipe.TartaricForgeRecipe;
|
||||
import WayofTime.bloodmagic.api.registry.TartaricForgeRecipeRegistry;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWill;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWillConduit;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWillGem;
|
||||
|
||||
public class TileSoulForge extends TileInventory implements ITickable
|
||||
public class TileSoulForge extends TileInventory implements ITickable, IDemonWillConduit
|
||||
{
|
||||
public static final int ticksRequired = 100;
|
||||
|
||||
|
@ -228,4 +230,97 @@ public class TileSoulForge extends TileInventory implements ITickable
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWeight()
|
||||
{
|
||||
return 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double fillDemonWill(EnumDemonWillType type, double amount, boolean doFill)
|
||||
{
|
||||
if (amount <= 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!canFill(type))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ItemStack stack = this.getStackInSlot(soulSlot);
|
||||
if (stack == null || !(stack.getItem() instanceof IDemonWillGem))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
IDemonWillGem willGem = (IDemonWillGem) stack.getItem();
|
||||
|
||||
double maxWill = willGem.getMaxWill(stack);
|
||||
double current = willGem.getWill(stack);
|
||||
|
||||
if (!doFill)
|
||||
{
|
||||
return Math.min(maxWill - current, amount);
|
||||
}
|
||||
|
||||
double filled = maxWill - current;
|
||||
|
||||
if (amount < filled)
|
||||
{
|
||||
willGem.setWill(stack, current + amount);
|
||||
filled = amount;
|
||||
} else
|
||||
{
|
||||
willGem.setWill(stack, maxWill);
|
||||
}
|
||||
|
||||
return filled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double drainDemonWill(EnumDemonWillType type, double amount, boolean doDrain)
|
||||
{
|
||||
ItemStack stack = this.getStackInSlot(soulSlot);
|
||||
if (stack == null || !(stack.getItem() instanceof IDemonWillGem))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
IDemonWillGem willGem = (IDemonWillGem) stack.getItem();
|
||||
|
||||
double drained = amount;
|
||||
double current = willGem.getWill(stack);
|
||||
if (current < drained)
|
||||
{
|
||||
drained = current;
|
||||
}
|
||||
|
||||
if (doDrain)
|
||||
{
|
||||
drained = willGem.drainWill(stack, drained);
|
||||
}
|
||||
|
||||
return drained;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(EnumDemonWillType type)
|
||||
{
|
||||
return type.equals(EnumDemonWillType.DEFAULT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(EnumDemonWillType type)
|
||||
{
|
||||
return type.equals(EnumDemonWillType.DEFAULT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCurrentWill(EnumDemonWillType type)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue