当前位置: 首页>>代码示例>>Java>>正文


Java IEssentiaTransport.getMinimumSuction方法代码示例

本文整理汇总了Java中thaumcraft.api.aspects.IEssentiaTransport.getMinimumSuction方法的典型用法代码示例。如果您正苦于以下问题:Java IEssentiaTransport.getMinimumSuction方法的具体用法?Java IEssentiaTransport.getMinimumSuction怎么用?Java IEssentiaTransport.getMinimumSuction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在thaumcraft.api.aspects.IEssentiaTransport的用法示例。


在下文中一共展示了IEssentiaTransport.getMinimumSuction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fillJar

import thaumcraft.api.aspects.IEssentiaTransport; //导入方法依赖的package包/类
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));
        }
    }
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:22,代码来源:TileBlockProtector.java

示例2: fillJar

import thaumcraft.api.aspects.IEssentiaTransport; //导入方法依赖的package包/类
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()));
        }
    }
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:25,代码来源:TileStickyJar.java

示例3: takeEssentiaFromTransportNeighbors

import thaumcraft.api.aspects.IEssentiaTransport; //导入方法依赖的package包/类
public void takeEssentiaFromTransportNeighbors(	final IEssentiaTransportWithSimulate destination, final World world, final int x, final int y,
												final int z )
{
	// Null checks
	if( ( destination == null ) || ( world == null ) )
	{
		return;
	}

	// For each side
	for( ForgeDirection destinationSide : ForgeDirection.VALID_DIRECTIONS )
	{
		// Can the destination accept essentia from this side?
		if( !destination.canInputFrom( destinationSide ) )
		{
			// Destination can not accept essentia from this side
			continue;
		}

		// Get the source
		TileEntity sourceTile = world.getTileEntity( destinationSide.offsetX + x, destinationSide.offsetY + y, destinationSide.offsetZ + z );

		// Ensure the source is a transport
		if( !( sourceTile instanceof IEssentiaTransport ) )
		{
			// Invalid source
			continue;
		}

		// Cast
		IEssentiaTransport source = (IEssentiaTransport)sourceTile;

		// Get the opposite direction
		ForgeDirection sourceSide = destinationSide.getOpposite();

		// Can the source output to this side?
		if( !source.canOutputTo( sourceSide ) )
		{
			// Source can not output to this side
			continue;
		}

		// Does the source have any essentia to give?
		if( source.getEssentiaAmount( sourceSide ) <= 0 )
		{
			// No essentia from this side
			continue;
		}

		// Does the destination have enough suction?
		int dSuck = destination.getSuctionAmount( destinationSide );
		if( ( dSuck < source.getMinimumSuction() ) || ( dSuck < source.getSuctionAmount( sourceSide ) ) )
		{
			// Destination does not have enough suction.
			continue;
		}

		// Get the source aspect
		Aspect sourceAspect = source.getEssentiaType( sourceSide );
		if( sourceAspect == null )
		{
			// Invalid aspect
			continue;
		}

		// Simulate an injection
		if( destination.addEssentia( sourceAspect, 1, destinationSide, Actionable.SIMULATE ) == 1 )
		{
			// Inject
			destination.addEssentia( sourceAspect, source.takeEssentia( sourceAspect, 1, sourceSide ), destinationSide, Actionable.MODULATE );
		}
	}
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:74,代码来源:EssentiaTransportHelper.java


注:本文中的thaumcraft.api.aspects.IEssentiaTransport.getMinimumSuction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。