Added in IBloodAltar and fixed a few derpy things
This commit is contained in:
parent
259699dfcf
commit
3a8c6e8418
|
@ -0,0 +1,26 @@
|
||||||
|
package WayofTime.alchemicalWizardry.api.tile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Pokefenn.
|
||||||
|
*/
|
||||||
|
public interface IBloodAltar
|
||||||
|
{
|
||||||
|
|
||||||
|
public int getCapacity();
|
||||||
|
|
||||||
|
public int getCurrentBlood();
|
||||||
|
|
||||||
|
public int getTier();
|
||||||
|
|
||||||
|
public int getProgress();
|
||||||
|
|
||||||
|
public float getSacrificeMultiplier();
|
||||||
|
|
||||||
|
public float getSelfSacrificeMultiplier();
|
||||||
|
|
||||||
|
public float getOrbMultiplier();
|
||||||
|
|
||||||
|
public float getDislocationMultiplier();
|
||||||
|
|
||||||
|
public int getBufferCapacity();
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package WayofTime.alchemicalWizardry.common.tileEntity;
|
package WayofTime.alchemicalWizardry.common.tileEntity;
|
||||||
|
|
||||||
|
import WayofTime.alchemicalWizardry.api.tile.IBloodAltar;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
@ -31,7 +32,7 @@ import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.AltarUpgradeCompone
|
||||||
import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.UpgradedAltars;
|
import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.UpgradedAltars;
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||||
|
|
||||||
public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFluidHandler
|
public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFluidHandler, IBloodAltar
|
||||||
{
|
{
|
||||||
public static final int sizeInv = 1;
|
public static final int sizeInv = 1;
|
||||||
private ItemStack[] inv;
|
private ItemStack[] inv;
|
||||||
|
@ -353,6 +354,54 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
|
||||||
return capacity;
|
return capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCurrentBlood()
|
||||||
|
{
|
||||||
|
return getFluidAmount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getTier()
|
||||||
|
{
|
||||||
|
return upgradeLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getProgress()
|
||||||
|
{
|
||||||
|
return progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getSacrificeMultiplier()
|
||||||
|
{
|
||||||
|
return sacrificeEfficiencyMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getSelfSacrificeMultiplier()
|
||||||
|
{
|
||||||
|
return selfSacrificeEfficiencyMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getOrbMultiplier()
|
||||||
|
{
|
||||||
|
return orbCapacityMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getDislocationMultiplier()
|
||||||
|
{
|
||||||
|
return dislocationMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBufferCapacity()
|
||||||
|
{
|
||||||
|
return bufferCapacity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidTankInfo getInfo()
|
public FluidTankInfo getInfo()
|
||||||
{
|
{
|
||||||
|
@ -393,6 +442,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
|
||||||
{
|
{
|
||||||
fluidInput = new FluidStack(resource, Math.min(bufferCapacity, resource.amount));
|
fluidInput = new FluidStack(resource, Math.min(bufferCapacity, resource.amount));
|
||||||
|
|
||||||
|
//The tile is never null, so we dont need this
|
||||||
if (tile != null)
|
if (tile != null)
|
||||||
{
|
{
|
||||||
FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this));
|
FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this));
|
||||||
|
@ -417,6 +467,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
|
||||||
fluidInput.amount = bufferCapacity;
|
fluidInput.amount = bufferCapacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Never null, so not needed :P
|
||||||
if (tile != null)
|
if (tile != null)
|
||||||
{
|
{
|
||||||
FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this));
|
FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this));
|
||||||
|
@ -451,6 +502,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
|
||||||
fluidOutput = null;
|
fluidOutput = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//This is never null, so its un needed :D
|
||||||
if (this != null)
|
if (this != null)
|
||||||
{
|
{
|
||||||
FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluidOutput, this.worldObj, this.xCoord, this.yCoord, this.zCoord, this));
|
FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluidOutput, this.worldObj, this.xCoord, this.yCoord, this.zCoord, this));
|
||||||
|
@ -513,6 +565,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//o,o this is always true
|
||||||
if (worldTime % 1 == 0)
|
if (worldTime % 1 == 0)
|
||||||
{
|
{
|
||||||
if (!canBeFilled)
|
if (!canBeFilled)
|
||||||
|
@ -544,7 +597,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
|
||||||
{
|
{
|
||||||
result.stackSize*=stackSize;
|
result.stackSize*=stackSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (!isResultBlock)
|
// if (!isResultBlock)
|
||||||
// {
|
// {
|
||||||
// result = new ItemStack(resultID, stackSize, resultDamage);
|
// result = new ItemStack(resultID, stackSize, resultDamage);
|
||||||
|
@ -703,7 +756,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluidStack flMain = new FluidStack(fluidData[0],fluidData[1]);
|
FluidStack flMain = new FluidStack(fluidData[0],fluidData[1]);
|
||||||
FluidStack flIn = new FluidStack(fluidData[2],fluidData[3]);
|
FluidStack flIn = new FluidStack(fluidData[2],fluidData[3]);
|
||||||
FluidStack flOut = new FluidStack(fluidData[4],fluidData[5]);
|
FluidStack flOut = new FluidStack(fluidData[4],fluidData[5]);
|
||||||
|
@ -761,7 +814,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
|
||||||
{
|
{
|
||||||
progress = 0;
|
progress = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(AltarRecipeRegistry.isRequiredItemValid(getStackInSlot(0), upgradeLevel))
|
if(AltarRecipeRegistry.isRequiredItemValid(getStackInSlot(0), upgradeLevel))
|
||||||
{
|
{
|
||||||
AltarRecipe recipe = AltarRecipeRegistry.getAltarRecipeForItemAndTier(getStackInSlot(0), upgradeLevel);
|
AltarRecipe recipe = AltarRecipeRegistry.getAltarRecipeForItemAndTier(getStackInSlot(0), upgradeLevel);
|
||||||
|
@ -772,7 +825,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
|
||||||
this.drainRate = recipe.drainRate;
|
this.drainRate = recipe.drainRate;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
isActive = false;
|
isActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -886,12 +939,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int slot, ItemStack itemstack)
|
public boolean isItemValidForSlot(int slot, ItemStack itemstack)
|
||||||
{
|
{
|
||||||
if (slot == 0)
|
return slot == 0;
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -957,12 +1005,8 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
|
||||||
public boolean canFill(ForgeDirection from, Fluid fluid)
|
public boolean canFill(ForgeDirection from, Fluid fluid)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
if (this.fluidInput != null && this.fluid.getFluid().equals(fluidInput))
|
//I changed this, since fluidstack != fluid... :p dunno if it was a accident? so you might wanna check this
|
||||||
{
|
return this.fluidInput != null && this.fluid.getFluid().equals(fluidInput.getFluid());
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -980,11 +1024,11 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
|
||||||
compositeTank.setFluid(fluid);
|
compositeTank.setFluid(fluid);
|
||||||
return new FluidTankInfo[]{compositeTank.getInfo()};
|
return new FluidTankInfo[]{compositeTank.getInfo()};
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[] buildFluidList()
|
public int[] buildFluidList()
|
||||||
{
|
{
|
||||||
int[] sortList = new int[6];
|
int[] sortList = new int[6];
|
||||||
|
|
||||||
if(this.fluid == null)
|
if(this.fluid == null)
|
||||||
{
|
{
|
||||||
sortList[0] = AlchemicalWizardry.lifeEssenceFluid.getID();
|
sortList[0] = AlchemicalWizardry.lifeEssenceFluid.getID();
|
||||||
|
@ -994,7 +1038,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
|
||||||
sortList[0] = this.fluid.fluidID;
|
sortList[0] = this.fluid.fluidID;
|
||||||
sortList[1] = this.fluid.amount;
|
sortList[1] = this.fluid.amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.fluidInput == null)
|
if(this.fluidInput == null)
|
||||||
{
|
{
|
||||||
sortList[2] = AlchemicalWizardry.lifeEssenceFluid.getID();
|
sortList[2] = AlchemicalWizardry.lifeEssenceFluid.getID();
|
||||||
|
@ -1004,7 +1048,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
|
||||||
sortList[2] = this.fluidInput.fluidID;
|
sortList[2] = this.fluidInput.fluidID;
|
||||||
sortList[3] = this.fluidInput.amount;
|
sortList[3] = this.fluidInput.amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.fluidOutput == null)
|
if(this.fluidOutput == null)
|
||||||
{
|
{
|
||||||
sortList[4] = AlchemicalWizardry.lifeEssenceFluid.getID();
|
sortList[4] = AlchemicalWizardry.lifeEssenceFluid.getID();
|
||||||
|
@ -1014,17 +1058,17 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
|
||||||
sortList[4] = this.fluidOutput.fluidID;
|
sortList[4] = this.fluidOutput.fluidID;
|
||||||
sortList[5] = this.fluidOutput.amount;
|
sortList[5] = this.fluidOutput.amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sortList;
|
return sortList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendChatInfoToPlayer(EntityPlayer player)
|
public void sendChatInfoToPlayer(EntityPlayer player)
|
||||||
{
|
{
|
||||||
player.addChatMessage(new ChatComponentText("Altar's Current Essence: " + this.fluid.amount + "LP"));
|
player.addChatMessage(new ChatComponentText("Altar's Current Essence: " + this.fluid.amount + "LP"));
|
||||||
player.addChatMessage(new ChatComponentText("Altar's Current Tier: " + UpgradedAltars.isAltarValid(worldObj, xCoord, yCoord, zCoord)));
|
player.addChatMessage(new ChatComponentText("Altar's Current Tier: " + UpgradedAltars.isAltarValid(worldObj, xCoord, yCoord, zCoord)));
|
||||||
player.addChatMessage(new ChatComponentText("Capacity: " + this.getCapacity() + "LP"));
|
player.addChatMessage(new ChatComponentText("Capacity: " + this.getCapacity() + "LP"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendMoreChatInfoToPlayer(EntityPlayer player)
|
public void sendMoreChatInfoToPlayer(EntityPlayer player)
|
||||||
{
|
{
|
||||||
if(getStackInSlot(0) != null)
|
if(getStackInSlot(0) != null)
|
||||||
|
|
Loading…
Reference in a new issue