2015-11-02 12:39:44 -08:00
|
|
|
package WayofTime.bloodmagic.tile;
|
2015-10-29 20:22:14 -07:00
|
|
|
|
2016-10-24 18:15:30 -04:00
|
|
|
import javax.annotation.Nonnull;
|
2016-11-12 11:52:38 -08:00
|
|
|
import javax.annotation.Nullable;
|
2016-10-24 18:15:30 -04:00
|
|
|
|
2015-11-03 10:34:11 -05:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
2015-10-29 20:22:14 -07:00
|
|
|
import net.minecraft.util.EnumFacing;
|
2015-11-29 10:49:13 -08:00
|
|
|
import net.minecraft.util.ITickable;
|
2016-10-24 18:15:30 -04:00
|
|
|
import net.minecraftforge.common.capabilities.Capability;
|
|
|
|
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
|
|
|
import WayofTime.bloodmagic.altar.BloodAltar;
|
|
|
|
import WayofTime.bloodmagic.api.altar.EnumAltarTier;
|
|
|
|
import WayofTime.bloodmagic.api.altar.IBloodAltar;
|
|
|
|
|
|
|
|
public class TileAltar extends TileInventory implements IBloodAltar, ITickable
|
2015-12-30 15:34:40 -05:00
|
|
|
{
|
|
|
|
private BloodAltar bloodAltar;
|
|
|
|
|
|
|
|
public TileAltar()
|
|
|
|
{
|
2015-10-29 20:22:14 -07:00
|
|
|
super(1, "altar");
|
2015-12-22 20:32:25 -05:00
|
|
|
this.bloodAltar = new BloodAltar(this);
|
2015-11-03 10:34:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-09-07 17:46:06 -07:00
|
|
|
public void deserialize(NBTTagCompound tagCompound)
|
2015-12-30 15:34:40 -05:00
|
|
|
{
|
2016-09-07 17:46:06 -07:00
|
|
|
super.deserialize(tagCompound);
|
2015-11-03 10:34:11 -05:00
|
|
|
|
2015-12-22 20:32:25 -05:00
|
|
|
NBTTagCompound altarTag = tagCompound.getCompoundTag("bloodAltar");
|
2015-12-30 15:34:40 -05:00
|
|
|
|
2015-12-22 20:32:25 -05:00
|
|
|
this.bloodAltar.readFromNBT(altarTag);
|
2015-10-29 20:22:14 -07:00
|
|
|
}
|
|
|
|
|
2015-11-02 21:30:28 -05:00
|
|
|
@Override
|
2016-09-07 17:46:06 -07:00
|
|
|
public NBTTagCompound serialize(NBTTagCompound tagCompound)
|
2015-12-30 15:34:40 -05:00
|
|
|
{
|
2016-09-07 17:46:06 -07:00
|
|
|
super.serialize(tagCompound);
|
2015-11-03 08:09:16 -08:00
|
|
|
|
2015-12-22 20:32:25 -05:00
|
|
|
NBTTagCompound altarTag = new NBTTagCompound();
|
|
|
|
this.bloodAltar.writeToNBT(altarTag);
|
2015-12-30 15:34:40 -05:00
|
|
|
|
2015-12-22 20:32:25 -05:00
|
|
|
tagCompound.setTag("bloodAltar", altarTag);
|
2016-05-19 17:43:33 -07:00
|
|
|
return tagCompound;
|
2015-11-03 10:34:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-12-30 15:34:40 -05:00
|
|
|
public void update()
|
|
|
|
{
|
2015-12-22 20:32:25 -05:00
|
|
|
bloodAltar.update();
|
2015-11-11 10:45:46 -08:00
|
|
|
}
|
|
|
|
|
2015-11-27 20:15:19 -05:00
|
|
|
@Override
|
2015-12-30 15:34:40 -05:00
|
|
|
public void sacrificialDaggerCall(int amount, boolean isSacrifice)
|
|
|
|
{
|
2015-12-22 20:32:25 -05:00
|
|
|
bloodAltar.sacrificialDaggerCall(amount, isSacrifice);
|
2015-11-02 21:30:28 -05:00
|
|
|
}
|
|
|
|
|
2015-11-03 10:34:11 -05:00
|
|
|
@Override
|
2015-12-30 15:34:40 -05:00
|
|
|
public boolean isItemValidForSlot(int slot, ItemStack itemstack)
|
|
|
|
{
|
2015-11-03 10:34:11 -05:00
|
|
|
return slot == 0;
|
|
|
|
}
|
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
@Override
|
|
|
|
public int getCapacity()
|
|
|
|
{
|
|
|
|
return bloodAltar.getCapacity();
|
|
|
|
}
|
2015-12-22 20:32:25 -05:00
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
@Override
|
|
|
|
public int getCurrentBlood()
|
|
|
|
{
|
|
|
|
return bloodAltar.getCurrentBlood();
|
|
|
|
}
|
2015-12-22 20:32:25 -05:00
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
@Override
|
|
|
|
public EnumAltarTier getTier()
|
|
|
|
{
|
|
|
|
return bloodAltar.getTier();
|
|
|
|
}
|
2015-12-22 20:32:25 -05:00
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
@Override
|
|
|
|
public int getProgress()
|
|
|
|
{
|
|
|
|
return bloodAltar.getProgress();
|
|
|
|
}
|
2015-12-22 20:32:25 -05:00
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
@Override
|
|
|
|
public float getSacrificeMultiplier()
|
|
|
|
{
|
|
|
|
return bloodAltar.getSacrificeMultiplier();
|
|
|
|
}
|
2015-12-22 20:32:25 -05:00
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
@Override
|
|
|
|
public float getSelfSacrificeMultiplier()
|
|
|
|
{
|
|
|
|
return bloodAltar.getSelfSacrificeMultiplier();
|
|
|
|
}
|
2015-12-22 20:32:25 -05:00
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
@Override
|
|
|
|
public float getOrbMultiplier()
|
|
|
|
{
|
|
|
|
return bloodAltar.getOrbMultiplier();
|
|
|
|
}
|
2015-12-22 20:32:25 -05:00
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
@Override
|
|
|
|
public float getDislocationMultiplier()
|
|
|
|
{
|
|
|
|
return bloodAltar.getDislocationMultiplier();
|
|
|
|
}
|
2015-12-22 20:32:25 -05:00
|
|
|
|
2015-12-27 19:38:12 -05:00
|
|
|
@Override
|
2015-12-30 15:34:40 -05:00
|
|
|
public float getConsumptionMultiplier()
|
|
|
|
{
|
2015-12-27 19:38:12 -05:00
|
|
|
return bloodAltar.getConsumptionMultiplier();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-12-30 15:34:40 -05:00
|
|
|
public float getConsumptionRate()
|
|
|
|
{
|
2015-12-27 19:38:12 -05:00
|
|
|
return bloodAltar.getConsumptionRate();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-12-30 15:34:40 -05:00
|
|
|
public int getLiquidRequired()
|
|
|
|
{
|
2015-12-27 19:38:12 -05:00
|
|
|
return bloodAltar.getLiquidRequired();
|
|
|
|
}
|
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
@Override
|
|
|
|
public int getBufferCapacity()
|
|
|
|
{
|
|
|
|
return bloodAltar.getBufferCapacity();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void startCycle()
|
|
|
|
{
|
|
|
|
bloodAltar.startCycle();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void checkTier()
|
|
|
|
{
|
|
|
|
bloodAltar.checkTier();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void requestPauseAfterCrafting(int cooldown)
|
|
|
|
{
|
|
|
|
bloodAltar.requestPauseAfterCrafting(cooldown);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isActive()
|
|
|
|
{
|
|
|
|
return bloodAltar.isActive();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int fillMainTank(int amount)
|
|
|
|
{
|
|
|
|
return bloodAltar.fillMainTank(amount);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setActive()
|
|
|
|
{
|
|
|
|
bloodAltar.setActive();
|
|
|
|
}
|
2016-01-01 17:36:50 -05:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getChargingRate()
|
|
|
|
{
|
|
|
|
return bloodAltar.getChargingRate();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getTotalCharge()
|
|
|
|
{
|
|
|
|
return bloodAltar.getTotalCharge();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getChargingFrequency()
|
|
|
|
{
|
|
|
|
return bloodAltar.getChargingFrequency();
|
|
|
|
}
|
2016-06-21 21:20:49 -04:00
|
|
|
|
|
|
|
public EnumAltarTier getCurrentTierDisplayed()
|
|
|
|
{
|
|
|
|
return bloodAltar.getCurrentTierDisplayed();
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean setCurrentTierDisplayed(EnumAltarTier altarTier)
|
|
|
|
{
|
|
|
|
return bloodAltar.setCurrentTierDisplayed(altarTier);
|
|
|
|
}
|
2016-10-24 18:15:30 -04:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing)
|
|
|
|
{
|
|
|
|
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return super.hasCapability(capability, facing);
|
|
|
|
}
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@Override
|
|
|
|
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing)
|
|
|
|
{
|
|
|
|
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
|
|
|
|
{
|
|
|
|
return (T) bloodAltar;
|
|
|
|
}
|
|
|
|
|
|
|
|
return super.getCapability(capability, facing);
|
|
|
|
}
|
2015-11-07 11:51:41 -05:00
|
|
|
}
|