• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java IAEFluidStack类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中appeng.api.storage.data.IAEFluidStack的典型用法代码示例。如果您正苦于以下问题:Java IAEFluidStack类的具体用法?Java IAEFluidStack怎么用?Java IAEFluidStack使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IAEFluidStack类属于appeng.api.storage.data包,在下文中一共展示了IAEFluidStack类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createAEFluidStackInFluidUnits

import appeng.api.storage.data.IAEFluidStack; //导入依赖的package包/类
/**
 * Creates an AE fluid stack from the specified essentia gas with the amount
 * specified.
 *
 * @param essentiaGas
 * @param fluidAmount
 * @return
 */
public IAEFluidStack createAEFluidStackInFluidUnits( final GaseousEssentia essentiaGas, final long fluidAmount )
{
	IAEFluidStack ret = null;
	try
	{
		ret = AEApi.instance().storage().createFluidStack( new FluidStack( essentiaGas, 1 ) );

		ret.setStackSize( fluidAmount );
	}
	catch( Exception e )
	{
	}

	return ret;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:24,代码来源:EssentiaConversionHelper.java


示例2: getFluidInventory

import appeng.api.storage.data.IAEFluidStack; //导入依赖的package包/类
@Override
public IMEMonitor<IAEFluidStack> getFluidInventory()
{
	// Check connectivity
	if( ( this.accessPoint == null ) || !this.isConnected() )
	{
		return null;
	}

	try
	{
		// Get the storage grid
		IStorageGrid storageGrid = this.accessPoint.getActionableNode().getGrid().getCache( IStorageGrid.class );

		// Return the monitor
		return storageGrid.getFluidInventory();
	}
	catch( Exception e )
	{
		// Ignored
	}

	return null;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:25,代码来源:WirelessAELink.java


示例3: canAccept

import appeng.api.storage.data.IAEFluidStack; //导入依赖的package包/类
/**
 * Checks if the sub-grid can accept this gas.
 */
@Override
public boolean canAccept( final IAEFluidStack fluidStack )
{
	// Is the fluid an essentia gas?
	if( this.isFluidEssentiaGas( fluidStack ) )
	{
		// Pass to handler
		if( this.handler != null )
		{
			return this.handler.canAccept( fluidStack );
		}
	}

	return false;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:19,代码来源:HandlerEssentiaStorageBusInterface.java


示例4: extractItems

import appeng.api.storage.data.IAEFluidStack; //导入依赖的package包/类
/**
 * Attempts to extract the gas from the sub-grid.
 */
@Override
public IAEFluidStack extractItems( final IAEFluidStack request, final Actionable mode, final BaseActionSource source )
{
	// Is the fluid an essentia gas?
	if( this.isFluidEssentiaGas( request ) )
	{
		if( this.handler != null )
		{
			// Extract the gas
			IAEFluidStack extractedGas = this.handler.extractItems( request, mode, source );

			return extractedGas;
		}
	}

	return null;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:21,代码来源:HandlerEssentiaStorageBusInterface.java


示例5: getAvailableItems

import appeng.api.storage.data.IAEFluidStack; //导入依赖的package包/类
/**
 * Gets the gases from the sub-grid.
 */
@Override
public IItemList<IAEFluidStack> getAvailableItems( final IItemList<IAEFluidStack> out )
{
	if( this.handler != null )
	{
		// Get the subgrids fluids
		IItemList<IAEFluidStack> subGridFluids = this.handler.getAvailableItems( AEApi.instance().storage().createFluidList() );

		for( IAEFluidStack fluid : subGridFluids )
		{
			// Is the fluid as essentia gas?
			if( this.isFluidEssentiaGas( fluid ) )
			{
				// Add to the output list
				out.add( fluid );
			}
		}

	}

	return out;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:26,代码来源:HandlerEssentiaStorageBusInterface.java


示例6: injectItems

import appeng.api.storage.data.IAEFluidStack; //导入依赖的package包/类
/**
 * Attempts to inject the gas into the sub-network.
 */
@Override
public IAEFluidStack injectItems( final IAEFluidStack input, final Actionable mode, final BaseActionSource source )
{
	// Is the fluid an essentia gas?
	if( this.isFluidEssentiaGas( input ) )
	{
		if( this.handler != null )
		{
			// Inject the gas
			IAEFluidStack remainingGas = this.handler.injectItems( input, mode, source );

			return remainingGas;
		}
	}
	return input;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:20,代码来源:HandlerEssentiaStorageBusInterface.java


示例7: isPrioritized

import appeng.api.storage.data.IAEFluidStack; //导入依赖的package包/类
/**
 * Checks if the specified is prioritized.
 */
@Override
public final boolean isPrioritized( final IAEFluidStack fluidStack )
{
	// Ensure the fluid stack is an essentia gas
	if( !this.isFluidEssentiaGas( fluidStack ) )
	{
		// Not an essentia gas.
		return false;
	}

	// Is the aspect prioritized?
	try
	{
		return this.filteredAspects.contains( ( (GaseousEssentia)fluidStack.getFluidStack().getFluid() ).getAspect() );
	}
	catch( Exception e )
	{
		return false;
	}
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:24,代码来源:HandlerEssentiaStorageBusBase.java


示例8: getAvailableItems

import appeng.api.storage.data.IAEFluidStack; //导入依赖的package包/类
/**
 * Gets the list of essentia gasses stored on the cell.
 */
@Override
public IItemList<IAEFluidStack> getAvailableItems( final IItemList<IAEFluidStack> availableList )
{
	for( IAspectStack essentiaStack : this.storedEssentia )
	{
		// Skip if null
		if( essentiaStack == null )
		{
			continue;
		}

		// Get the gas
		GaseousEssentia essentiaGas = GaseousEssentia.getGasFromAspect( essentiaStack.getAspect() );

		// Create the AE fluid stack
		availableList.add( EssentiaConversionHelper.INSTANCE.createAEFluidStackInEssentiaUnits( essentiaGas, essentiaStack.getStackSize() ) );

	}

	return availableList;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:25,代码来源:HandlerItemEssentiaCell.java


示例9: extractItems

import appeng.api.storage.data.IAEFluidStack; //导入依赖的package包/类
/**
 * The creative cell can only provide essentia based on its parition table.
 */
@Override
public IAEFluidStack extractItems( final IAEFluidStack request, final Actionable mode, final BaseActionSource src )
{
	// Ensure there is a request, and that it is an essentia gas
	if( ( request != null ) && ( request.getFluid() != null ) && ( request.getFluid() instanceof GaseousEssentia ) )
	{
		// Get the aspect of the essentia
		Aspect requestAspect = ( (GaseousEssentia)request.getFluid() ).getAspect();

		// Is the cell partitioned for this aspect?
		if( ( requestAspect != null ) && ( this.partitionAspects.contains( requestAspect ) ) )
		{
			return request.copy();
		}
	}

	return null;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:22,代码来源:HandlerItemEssentiaCellCreative.java


示例10: getAvailableItems

import appeng.api.storage.data.IAEFluidStack; //导入依赖的package包/类
/**
 * Available items based on partition table.
 */
@Override
public IItemList<IAEFluidStack> getAvailableItems( final IItemList<IAEFluidStack> availableList )
{
	for( Aspect aspect : this.partitionAspects )
	{
		// Get the gas
		GaseousEssentia essentiaGas = GaseousEssentia.getGasFromAspect( aspect );

		// Create the AE fluid stack
		availableList.add( EssentiaConversionHelper.INSTANCE.createAEFluidStackInEssentiaUnits( essentiaGas, 2000000000 ) );

	}

	return availableList;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:19,代码来源:HandlerItemEssentiaCellCreative.java


示例11: injectFluidIntoContainer

import appeng.api.storage.data.IAEFluidStack; //导入依赖的package包/类
/**
 * Attempts to inject the fluid into the container.
 * Returns the amount that was injected in milibuckets.
 *
 * @param container
 * @param fluidStack
 * @param mode
 * @return
 */
public long injectFluidIntoContainer( final IAspectContainer container, final IAEFluidStack fluidStack, final Actionable mode )
{
	// Do we have an input?
	if( fluidStack == null )
	{
		// No input
		return 0;
	}

	// Is the container whitelisted?
	if( !this.perms.canInjectToAspectContainerTile( container ) )
	{
		// Not whitelisted
		return 0;
	}

	// Get the fluid.
	Fluid fluid = fluidStack.getFluid();

	// Ensure it is a gas
	if( !( fluid instanceof GaseousEssentia ) )
	{
		// Not essentia gas
		return 0;
	}

	// Get the aspect of the gas
	Aspect gasAspect = ( (GaseousEssentia)fluid ).getAspect();

	// Get the amount to fill
	long amountToFill = EssentiaConversionHelper.INSTANCE.convertFluidAmountToEssentiaAmount( fluidStack.getStackSize() );

	// Inject
	long injectedAmount_EU = this.injectEssentiaIntoContainer( container, (int)amountToFill, gasAspect, mode );

	return EssentiaConversionHelper.INSTANCE.convertEssentiaAmountToFluidAmount( injectedAmount_EU );
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:47,代码来源:EssentiaTileContainerHelper.java


示例12: convertAEFluidStackToAspectStack

import appeng.api.storage.data.IAEFluidStack; //导入依赖的package包/类
/**
 * Converts an AE fluid stack into an AspectStack.
 *
 * @param fluidStack
 * @return Aspect stack if converted, null otherwise.
 */
public AspectStack convertAEFluidStackToAspectStack( final IAEFluidStack fluidStack )
{
	// Is the fluid an essentia gas?
	if( fluidStack.getFluid() instanceof GaseousEssentia )
	{
		// Create an aspect stack to match the fluid
		return new AspectStack( ( (GaseousEssentia)fluidStack.getFluid() ).getAspect(), this.convertFluidAmountToEssentiaAmount( fluidStack
						.getStackSize() ) );
	}

	return null;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:19,代码来源:EssentiaConversionHelper.java


示例13: createAEFluidStackInEssentiaUnits

import appeng.api.storage.data.IAEFluidStack; //导入依赖的package包/类
/**
 * Creates an AE fluid stack from the specified essentia gas. This will
 * convert the specified amount from essentia units to fluid units(mb).
 *
 * @param Aspect
 * @param essentiaAmount
 * @return
 */
public IAEFluidStack createAEFluidStackInEssentiaUnits( final Aspect aspect, final long essentiaAmount )
{
	GaseousEssentia essentiaGas = GaseousEssentia.getGasFromAspect( aspect );

	if( essentiaGas == null )
	{
		return null;
	}

	return this.createAEFluidStackInFluidUnits( essentiaGas, this.convertEssentiaAmountToFluidAmount( essentiaAmount ) );
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:20,代码来源:EssentiaConversionHelper.java


示例14: injectEssentiaSafely

import appeng.api.storage.data.IAEFluidStack; //导入依赖的package包/类
/**
 * Mirror method of the injectEssentia. Used to defer power calculations, because the simulation is not always accurate, and Essentia gas should
 * not be stored in partial amounts.
 *
 * @param aspect
 * @param amount
 * @param mode
 * @param source
 * @return Amount that was <strong>not</strong> injected
 */
private long injectEssentiaSafely(	final Aspect aspect, final long amount, final Actionable mode, final BaseActionSource source,
									final GaseousEssentia essentiaGas )
{
	// Create the fluid request
	IAEFluidStack fluidRequest = EssentiaConversionHelper.INSTANCE.createAEFluidStackInEssentiaUnits( essentiaGas, amount );

	// Inject fluid
	IAEFluidStack fluidRejected = this.fluidMonitor.injectItems( fluidRequest, mode, source );

	// Was any rejected?
	if( ( fluidRejected != null ) && ( fluidRejected.getStackSize() > 0 ) )
	{
		if( fluidRejected.getStackSize() == fluidRequest.getStackSize() )
		{
			// All essentia was rejected
			return amount;
		}

		// Calculate the adjusted amount, essentia gas can not be stored in partial units
		long rejectedAdjustedAmount = EssentiaConversionHelper.INSTANCE.convertFluidAmountToEssentiaAmount( fluidRejected.getStackSize() );
		return rejectedAdjustedAmount;
	}

	// All essentia was accepted.
	return 0;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:37,代码来源:EssentiaMonitor.java


示例15: wrap

import appeng.api.storage.data.IAEFluidStack; //导入依赖的package包/类
/**
 * Wraps the specified fluid monitor and energy grid.
 *
 * @param fluidMonitor
 * Fluid monitor to listen to
 * @param energyGrid
 * Energy grid to extract power from
 * @param validationToken
 * Used to validate the state of the fluid listener, can not be null
 */
public void wrap( final IMEMonitor<IAEFluidStack> fluidMonitor, final IEnergyGrid energyGrid, final Object validationToken )
{
	// Ensure the token is not null
	if( validationToken != null )
	{
		// Set the token
		this.token = new WeakReference<Object>( validationToken );
	}
	else
	{
		// Throw exception
		throw new NullPointerException( "Validation Token Can Not Be Null" );
	}

	// Set the fluid monitor
	this.fluidMonitor = fluidMonitor;

	// Set the energy grid
	this.energyGrid = energyGrid;

	// Add listener
	this.fluidMonitor.addListener( this, this.token );

	// Mark that the cache needs to be updated
	this.cacheNeedsUpdate = true;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:37,代码来源:EssentiaMonitor.java


示例16: canAccept

import appeng.api.storage.data.IAEFluidStack; //导入依赖的package包/类
@Override
public boolean canAccept( final IAEFluidStack fluidStack )
{
	// Ensure we have an internal handler
	if( this.internalHandler != null )
	{
		// Pass to handler
		return this.internalHandler.canAccept( fluidStack );
	}

	// No handler
	return false;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:14,代码来源:HandlerEssentiaStorageBusDuality.java


示例17: extractItems

import appeng.api.storage.data.IAEFluidStack; //导入依赖的package包/类
@Override
public IAEFluidStack extractItems( final IAEFluidStack request, final Actionable mode, final BaseActionSource source )
{
	// Ensure we have an internal handler
	if( this.internalHandler != null )
	{
		// Pass to handler
		return this.internalHandler.extractItems( request, mode, source );
	}

	// No handler
	return null;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:14,代码来源:HandlerEssentiaStorageBusDuality.java


示例18: getAvailableItems

import appeng.api.storage.data.IAEFluidStack; //导入依赖的package包/类
@Override
public IItemList<IAEFluidStack> getAvailableItems( final IItemList<IAEFluidStack> out )
{
	// Ensure we have an internal handler
	if( this.internalHandler != null )
	{
		// Pass to handler
		return this.internalHandler.getAvailableItems( out );
	}

	// No handler
	return out;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:14,代码来源:HandlerEssentiaStorageBusDuality.java


示例19: injectItems

import appeng.api.storage.data.IAEFluidStack; //导入依赖的package包/类
@Override
public IAEFluidStack injectItems( final IAEFluidStack input, final Actionable mode, final BaseActionSource source )
{
	// Ensure we have an internal handler
	if( this.internalHandler != null )
	{
		// Pass to handler
		return this.internalHandler.injectItems( input, mode, source );
	}

	// No handler
	return input;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:14,代码来源:HandlerEssentiaStorageBusDuality.java


示例20: postChange

import appeng.api.storage.data.IAEFluidStack; //导入依赖的package包/类
/**
 * A change occurred in the sub-grid, inform the host grid.
 */
@Override
public void postChange( final IBaseMonitor<IAEFluidStack> monitor, final Iterable<IAEFluidStack> change, final BaseActionSource actionSource )
{
	try
	{
		IActionHost actionHost = null;

		// Get the action source
		if( actionSource instanceof PlayerSource )
		{
			// From the player source
			actionHost = ( (PlayerSource)actionSource ).via;
		}
		else if( actionSource instanceof MachineSource )
		{
			// From the machine source
			actionHost = ( (MachineSource)actionSource ).via;
		}

		// Ensure there is an action host
		if( actionHost != null )
		{
			// Post update if change did not come from host grid, prevents double posting.
			if( actionHost.getActionableNode().getGrid() != this.partStorageBus.getActionableNode().getGrid() )
			{
				// Update the host grid
				this.postAlterationToHostGrid( change );
			}
		}
	}
	catch( Exception e )
	{

	}
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:39,代码来源:HandlerEssentiaStorageBusInterface.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ErrorConstants类代码示例发布时间:2022-05-23
下一篇:
Java SGLRException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap