Pre-emptive things
This commit is contained in:
parent
5985be1cd0
commit
75143520ed
7 changed files with 417 additions and 167 deletions
|
@ -1,74 +1,93 @@
|
|||
package WayofTime.bloodmagic.tile;
|
||||
|
||||
import WayofTime.bloodmagic.altar.BloodAltar;
|
||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.api.altar.AltarRecipe;
|
||||
import WayofTime.bloodmagic.api.altar.AltarUpgrade;
|
||||
import WayofTime.bloodmagic.api.altar.EnumAltarTier;
|
||||
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry;
|
||||
import net.minecraft.server.gui.IUpdatePlayerListBox;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
||||
public class TileAltar extends TileInventory implements IUpdatePlayerListBox, IFluidTank, IFluidHandler {
|
||||
|
||||
public class TileAltar extends TileInventory implements IUpdatePlayerListBox, IFluidTank, IFluidHandler
|
||||
{
|
||||
private int tier;
|
||||
private AltarUpgrade upgrade = new AltarUpgrade();
|
||||
private FluidStack fluid = new FluidStack(BloodMagicAPI.getLifeEssence(), 0);
|
||||
private int capacity;
|
||||
|
||||
public TileAltar() {
|
||||
public TileAltar()
|
||||
{
|
||||
super(1, "altar");
|
||||
|
||||
this.capacity = 10000;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void update() {}
|
||||
public void update()
|
||||
{
|
||||
if (getWorld().isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void update() {
|
||||
// if (getWorld().isRemote)
|
||||
// return;
|
||||
//
|
||||
// if (getWorld().getTotalWorldTime() % (Math.max(20 - getUpgrade().getSpeedCount(), 1)) == 0) {
|
||||
// everySecond();
|
||||
// }
|
||||
//
|
||||
// if (getWorld().getTotalWorldTime() % 100 == 0) {
|
||||
// everyFiveSeconds();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void everySecond() {
|
||||
//
|
||||
// // Do recipes
|
||||
// if (AltarRecipeRegistry.getRecipes().containsKey(getStackInSlot(0))) {
|
||||
// AltarRecipe recipe = AltarRecipeRegistry.getRecipeForInput(getStackInSlot(0));
|
||||
//
|
||||
// if (!(tier >= recipe.minTier))
|
||||
// return;
|
||||
//
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void everyFiveSeconds() {
|
||||
// checkTier();
|
||||
// }
|
||||
//
|
||||
// private void checkTier() {
|
||||
// // TODO - Write checking for tier stuff
|
||||
// }
|
||||
if (getWorld().getTotalWorldTime() % (Math.max(20 - getUpgrade().getSpeedCount(), 1)) == 0)
|
||||
{
|
||||
everySecond();
|
||||
}
|
||||
|
||||
public TileAltar setUpgrade(AltarUpgrade upgrade) {
|
||||
if (getWorld().getTotalWorldTime() % 100 == 0)
|
||||
{
|
||||
everyFiveSeconds();
|
||||
}
|
||||
}
|
||||
|
||||
private void everySecond()
|
||||
{
|
||||
// Do recipes
|
||||
if (AltarRecipeRegistry.getRecipes().containsKey(getStackInSlot(0)))
|
||||
{
|
||||
AltarRecipe recipe = AltarRecipeRegistry.getRecipeForInput(getStackInSlot(0));
|
||||
|
||||
if (!(tier >= recipe.minTier))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void everyFiveSeconds()
|
||||
{
|
||||
checkTier();
|
||||
}
|
||||
|
||||
private void checkTier()
|
||||
{
|
||||
// TODO - Write checking for tier stuff
|
||||
|
||||
EnumAltarTier tier = BloodAltar.getAltarTier(getWorld(), getPos());
|
||||
|
||||
if (tier.equals(EnumAltarTier.ONE))
|
||||
{
|
||||
upgrade = new AltarUpgrade();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public TileAltar setUpgrade(AltarUpgrade upgrade)
|
||||
{
|
||||
this.upgrade = upgrade;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AltarUpgrade getUpgrade() {
|
||||
public AltarUpgrade getUpgrade()
|
||||
{
|
||||
return upgrade;
|
||||
}
|
||||
|
||||
public TileAltar setTier(int tier) {
|
||||
public TileAltar setTier(int tier)
|
||||
{
|
||||
this.tier = tier;
|
||||
return this;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue