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

The following examples show how to use thaumcraft.api.aspects.IEssentiaTransport#getSuctionAmount() . 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: AdapterEssentiaTransport.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.NUMBER, description = "Returns the amount of suction in the tube")
public int getSuctionAmount(IEssentiaTransport pipe,
		@Arg(description = "Direction suction coming from", name = "direction") ForgeDirection direction) {
	return pipe.getSuctionAmount(direction);
}