thaumcraft.api.aspects.IEssentiaTransport Java Examples

The following examples show how to use thaumcraft.api.aspects.IEssentiaTransport. 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: 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 #2
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 #3
Source File: ThaumcraftApiHelper.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public static TileEntity getConnectableTile(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
	TileEntity te = world.getTileEntity(x+face.offsetX, y+face.offsetY, z+face.offsetZ);
	if (te instanceof IEssentiaTransport && ((IEssentiaTransport)te).isConnectable(face.getOpposite())) 
		return te;
	else
		return null;
}
 
Example #4
Source File: ThaumcraftApiHelper.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public static TileEntity getConnectableTile(World world, int x, int y, int z, ForgeDirection face) {
	TileEntity te = world.getTileEntity(x+face.offsetX, y+face.offsetY, z+face.offsetZ);
	if (te instanceof IEssentiaTransport && ((IEssentiaTransport)te).isConnectable(face.getOpposite())) 
		return te;
	else
		return null;
}
 
Example #5
Source File: ThaumcraftApiHelper.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public static TileEntity getConnectableTile(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
	TileEntity te = world.getTileEntity(x+face.offsetX, y+face.offsetY, z+face.offsetZ);
	if (te instanceof IEssentiaTransport && ((IEssentiaTransport)te).isConnectable(face.getOpposite())) 
		return te;
	else
		return null;
}
 
Example #6
Source File: ThaumcraftApiHelper.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public static TileEntity getConnectableTile(World world, int x, int y, int z, ForgeDirection face) {
	TileEntity te = world.getTileEntity(x+face.offsetX, y+face.offsetY, z+face.offsetZ);
	if (te instanceof IEssentiaTransport && ((IEssentiaTransport)te).isConnectable(face.getOpposite())) 
		return te;
	else
		return null;
}
 
Example #7
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;
            }
        }
    }
}
 
Example #8
Source File: ThaumcraftApiHelper.java    From GardenCollection with MIT License 5 votes vote down vote up
public static TileEntity getConnectableTile(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
	TileEntity te = world.getTileEntity(x+face.offsetX, y+face.offsetY, z+face.offsetZ);
	if (te instanceof IEssentiaTransport && ((IEssentiaTransport)te).isConnectable(face.getOpposite())) 
		return te;
	else
		return null;
}
 
Example #9
Source File: ThaumcraftApiHelper.java    From GardenCollection with MIT License 5 votes vote down vote up
public static TileEntity getConnectableTile(World world, int x, int y, int z, ForgeDirection face) {
	TileEntity te = world.getTileEntity(x+face.offsetX, y+face.offsetY, z+face.offsetZ);
	if (te instanceof IEssentiaTransport && ((IEssentiaTransport)te).isConnectable(face.getOpposite())) 
		return te;
	else
		return null;
}
 
Example #10
Source File: ThaumcraftApiHelper.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
public static TileEntity getConnectableTile(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
	TileEntity te = world.getTileEntity(x+face.offsetX, y+face.offsetY, z+face.offsetZ);
	if (te instanceof IEssentiaTransport && ((IEssentiaTransport)te).isConnectable(face.getOpposite())) 
		return te;
	else
		return null;
}
 
Example #11
Source File: ThaumcraftApiHelper.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
public static TileEntity getConnectableTile(World world, int x, int y, int z, ForgeDirection face) {
	TileEntity te = world.getTileEntity(x+face.offsetX, y+face.offsetY, z+face.offsetZ);
	if (te instanceof IEssentiaTransport && ((IEssentiaTransport)te).isConnectable(face.getOpposite())) 
		return te;
	else
		return null;
}
 
Example #12
Source File: ThaumcraftApiHelper.java    From AdvancedMod with GNU General Public License v3.0 5 votes vote down vote up
public static TileEntity getConnectableTile(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
	TileEntity te = world.getTileEntity(x+face.offsetX, y+face.offsetY, z+face.offsetZ);
	if (te instanceof IEssentiaTransport && ((IEssentiaTransport)te).isConnectable(face.getOpposite())) 
		return te;
	else
		return null;
}
 
Example #13
Source File: ThaumcraftApiHelper.java    From AdvancedMod with GNU General Public License v3.0 5 votes vote down vote up
public static TileEntity getConnectableTile(World world, int x, int y, int z, ForgeDirection face) {
	TileEntity te = world.getTileEntity(x+face.offsetX, y+face.offsetY, z+face.offsetZ);
	if (te instanceof IEssentiaTransport && ((IEssentiaTransport)te).isConnectable(face.getOpposite())) 
		return te;
	else
		return null;
}
 
Example #14
Source File: ThaumcraftApiHelper.java    From OpenPeripheral-Integration with MIT License 5 votes vote down vote up
public static TileEntity getConnectableTile(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
	TileEntity te = world.getTileEntity(x+face.offsetX, y+face.offsetY, z+face.offsetZ);
	if (te instanceof IEssentiaTransport && ((IEssentiaTransport)te).isConnectable(face.getOpposite())) 
		return te;
	else
		return null;
}
 
Example #15
Source File: ThaumcraftApiHelper.java    From OpenPeripheral-Integration with MIT License 5 votes vote down vote up
public static TileEntity getConnectableTile(World world, int x, int y, int z, ForgeDirection face) {
	TileEntity te = world.getTileEntity(x+face.offsetX, y+face.offsetY, z+face.offsetZ);
	if (te instanceof IEssentiaTransport && ((IEssentiaTransport)te).isConnectable(face.getOpposite())) 
		return te;
	else
		return null;
}
 
Example #16
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 #17
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 #18
Source File: AdapterEssentiaTransport.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.STRING, description = "Returns the type of essentia in the tube")
public String getEssentiaType(IEssentiaTransport pipe,
		@Arg(description = "Direction suction coming from", name = "direction") ForgeDirection direction) {
	Aspect asp = pipe.getEssentiaType(direction);
	return (asp != null)? asp.getTag() : "";
}
 
Example #19
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 essentia in the tube")
public int getEssentiaAmount(IEssentiaTransport pipe,
		@Arg(description = "Direction suction coming from", name = "direction") ForgeDirection direction) {
	return pipe.getEssentiaAmount(direction);
}
 
Example #20
Source File: AdapterEssentiaTransport.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.STRING, description = "Returns the type of essentia wished in the tube")
public String getSuctionType(IEssentiaTransport pipe,
		@Arg(description = "Direction suction coming from", name = "direction") ForgeDirection direction) {
	Aspect asp = pipe.getSuctionType(direction);
	return (asp != null)? asp.getTag() : "";
}
 
Example #21
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);
}
 
Example #22
Source File: AdapterEssentiaTransport.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@Override
public Class<?> getTargetClass() {
	return IEssentiaTransport.class;
}