Fixed Portal ritual.

This commit is contained in:
WayofTime 2016-02-18 12:11:29 -05:00
parent 7979dc4e5f
commit 34a9b5a7ec
8 changed files with 151 additions and 45 deletions

View file

@ -27,7 +27,7 @@ public class TileDemonCrucible extends TileInventory implements ITickable, IDemo
public HashMap<EnumDemonWillType, Double> willMap = new HashMap<EnumDemonWillType, Double>();
public final int maxWill = 100;
public final double maxTransferPerTick = 1;
public final double thresholdFill = 0.0;
public final double thresholdFill = 0.01;
public final double gemDrainRate = 10;
public int internalCounter = 0;
@ -192,9 +192,13 @@ public class TileDemonCrucible extends TileInventory implements ITickable, IDemo
transfer = conduit.fillDemonWill(type, transfer, false);
if (transfer > 0)
{
worldObj.markBlockForUpdate(((TileEntity) conduit).getPos());
conduit.fillDemonWill(type, transfer, true);
currentAmount -= transfer;
transfered += transfer;
} else
{
conduitIterator.remove();
}
}

View file

@ -63,7 +63,7 @@ public class TileMasterRitualStone extends TileEntity implements IMasterRitualSt
active = true;
ItemStack crystalStack = NBTHelper.checkNBT(new ItemStack(ModItems.activationCrystal, 1, getCurrentRitual().getCrystalLevel()));
crystalStack.getTagCompound().setString(Constants.NBT.OWNER_UUID, getOwner());
activateRitual(crystalStack, PlayerHelper.getPlayerFromUUID(getOwner()), getCurrentRitual());
activateRitual(crystalStack, null, getCurrentRitual());
redstoned = false;
}
@ -150,7 +150,7 @@ public class TileMasterRitualStone extends TileEntity implements IMasterRitualSt
return false;
}
if (ritual.activateRitual(this, activator))
if (ritual.activateRitual(this, activator, crystalOwner))
{
if (!isRedstoned() && !activator.capabilities.isCreativeMode)
network.syphon(ritual.getActivationCost());

View file

@ -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;
}
}