Java Code Examples for thaumcraft.api.aspects.IEssentiaTransport#canOutputTo()

The following examples show how to use thaumcraft.api.aspects.IEssentiaTransport#canOutputTo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TileBlockProtector.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void fillJar() {
    TileEntity te = ThaumcraftApiHelper.getConnectableTile(this.worldObj, this.xCoord, this.yCoord, this.zCoord, ForgeDirection.DOWN);
    if (te != null) {
        IEssentiaTransport ic = (IEssentiaTransport) te;
        if (!ic.canOutputTo(ForgeDirection.UP)) {
            return;
        }
        Aspect ta = null;
        if (this.aspectFilter != null) {
            ta = this.aspectFilter;
        } else if ((this.aspect != null) && (this.amount > 0)) {
            ta = this.aspect;
        } else if ((ic.getEssentiaAmount(ForgeDirection.UP) > 0) &&
                (ic.getSuctionAmount(ForgeDirection.UP) < getSuctionAmount(ForgeDirection.DOWN)) && (getSuctionAmount(ForgeDirection.DOWN) >= ic.getMinimumSuction())) {
            ta = ic.getEssentiaType(ForgeDirection.UP);
        }
        if ((ta != null) && (ic.getSuctionAmount(ForgeDirection.UP) < getSuctionAmount(ForgeDirection.DOWN))) {
            addToContainer(ta, ic.takeEssentia(ta, 1, ForgeDirection.UP));
        }
    }
}
 
Example 2
Source File: TileStickyJar.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void fillJar() {
    ForgeDirection inputDir = placedOn.getOpposite();

    TileEntity te = ThaumcraftApiHelper.getConnectableTile(parent.getWorldObj(), parent.xCoord, parent.yCoord, parent.zCoord, inputDir);
    if (te != null)
    {
        IEssentiaTransport ic = (IEssentiaTransport)te;
        if (!ic.canOutputTo(ForgeDirection.DOWN)) {
            return;
        }
        Aspect ta = null;
        if (parent.aspectFilter != null) {
            ta = parent.aspectFilter;
        } else if ((parent.aspect != null) && (parent.amount > 0)) {
            ta = parent.aspect;
        } else if ((ic.getEssentiaAmount(inputDir.getOpposite()) > 0) &&
                (ic.getSuctionAmount(inputDir.getOpposite()) < getSuctionAmount(ForgeDirection.UP)) && (getSuctionAmount(ForgeDirection.UP) >= ic.getMinimumSuction())) {
            ta = ic.getEssentiaType(inputDir.getOpposite());
        }
        if ((ta != null) && (ic.getSuctionAmount(inputDir.getOpposite()) < getSuctionAmount(ForgeDirection.UP))) {
            addToContainer(ta, ic.takeEssentia(ta, 1, inputDir.getOpposite()));
        }
    }
}
 
Example 3
Source File: TileAuraPylon.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void handleIO() {
    if ((!worldObj.isRemote) && ((ticksExisted & 15) == 0) && (getEssentiaAmount() < getMaxAmount())) {
        TileEntity te = ThaumcraftApiHelper.getConnectableTile(this.worldObj, this.xCoord, this.yCoord, this.zCoord, ForgeDirection.DOWN);
        if (te != null) {
            IEssentiaTransport ic = (IEssentiaTransport) te;
            if (!ic.canOutputTo(ForgeDirection.UP)) {
                return;
            }

            if ((holdingAspect != null) && (ic.getSuctionAmount(ForgeDirection.UP) < getSuctionAmount(ForgeDirection.DOWN))) {
                addToContainer(holdingAspect, ic.takeEssentia(holdingAspect, 1, ForgeDirection.UP));
            }
        }
    }
}
 
Example 4
Source File: TileAIShutdown.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void handleIO() {
    if (storedAmount < MAX_AMT) {
        TileEntity te = ThaumcraftApiHelper.getConnectableTile(this.worldObj, this.xCoord, this.yCoord, this.zCoord, ForgeDirection.UP);
        if (te != null) {
            IEssentiaTransport ic = (IEssentiaTransport) te;
            if (!ic.canOutputTo(ForgeDirection.DOWN)) {
                return;
            }

            if (ic.getSuctionAmount(ForgeDirection.DOWN) < getSuctionAmount(ForgeDirection.UP)) {
                addToContainer(Aspect.ENTROPY, ic.takeEssentia(Aspect.ENTROPY, 1, ForgeDirection.DOWN));
            }
        }
    }
}
 
Example 5
Source File: TileEntityWrathCage.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
void drawEssentia()
{
    for(int x = 0;x < ForgeDirection.VALID_DIRECTIONS.length;x++){
        ForgeDirection current = ForgeDirection.VALID_DIRECTIONS[x];
        TileEntity te = ThaumcraftApiHelper.getConnectableTile(worldObj, xCoord, yCoord, zCoord, current);
        if(te != null) {
            IEssentiaTransport ic = (IEssentiaTransport)te;
            if(ic.canOutputTo(current.getOpposite()) && special < 64 //THE DIRECTION HERE MAY BE WRONG SPITEFULFOXY SO CHECK IT
                && ic.getEssentiaType(current.getOpposite()) == aspect && ic.getEssentiaAmount(current.getOpposite()) > 0 && ic.takeEssentia(aspect, 1, current.getOpposite()) == 1) {
                special++;
                worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
                return;
            }
            else if(ic.canOutputTo(current.getOpposite()) && wrath < 64 && special < Config.wrathCost
                && ic.getEssentiaType(current.getOpposite()) == DarkAspects.WRATH && ic.getEssentiaAmount(current.getOpposite()) > 0 && ic.takeEssentia(DarkAspects.WRATH, 1, current.getOpposite()) == 1) {
                wrath++;
                worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
                return;
            }
            else if(ic.canOutputTo(current.getOpposite()) && sloth < 64 && special < Config.wrathCost && wrath < Config.wrathCost
                && ic.getEssentiaType(current.getOpposite()) == DarkAspects.SLOTH && ic.getEssentiaAmount(current.getOpposite()) > 0 && ic.takeEssentia(DarkAspects.SLOTH, 1, current.getOpposite()) == 1) {
                sloth++;
                worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
                return;
            }
        }
    }
}