BloodMagic/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellBlock.java

49 lines
1.4 KiB
Java
Raw Normal View History

package WayofTime.alchemicalWizardry.common.tileEntity;
2014-10-13 20:33:20 +00:00
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
2014-10-13 20:33:20 +00:00
public abstract class TESpellBlock extends TEOrientable
{
2014-10-13 20:33:20 +00:00
public void modifySpellParadigm(SpellParadigm parad)
{
this.applySpellChange(parad);
TileEntity tile = this.getTileAtOutput();
if (tile instanceof TESpellBlock)
{
TESpellBlock outputBlock = (TESpellBlock) tile;
outputBlock.modifySpellParadigm(parad);
}
}
protected abstract void applySpellChange(SpellParadigm parad);
public TESpellBlock getTileAtOutput()
{
ForgeDirection output = this.getOutputDirection();
int xOffset = output.offsetX;
int yOffset = output.offsetY;
int zOffset = output.offsetZ;
TileEntity tile = worldObj.getTileEntity(xCoord + xOffset, yCoord + yOffset, zCoord + zOffset);
if (tile instanceof TESpellBlock && ((TESpellBlock) tile).canInputRecieveOutput(output))
{
return (TESpellBlock) tile;
}
return null;
}
public boolean canInputRecieve()
{
return true;
}
public boolean canInputRecieveOutput(ForgeDirection output)
{
return this.canInputRecieve() && this.getInputDirection().getOpposite() == output;
}
}