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

Java IEnergyGrid类代码示例

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

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



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

示例1: getEnergyGrid

import appeng.api.networking.energy.IEnergyGrid; //导入依赖的package包/类
public IEnergyGrid getEnergyGrid()
{
	// Check AP
	if( this.accessPoint == null )
	{
		return null;
	}

	try
	{
		// Get the energy grid
		return this.accessPoint.getActionableNode().getGrid().getCache( IEnergyGrid.class );
	}
	catch( Exception e )
	{
		// Ignored
	}

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


示例2: extractPowerForEssentiaTransfer

import appeng.api.networking.energy.IEnergyGrid; //导入依赖的package包/类
/**
 * Extracts power from the network proportional to the specified essentia
 * amount.
 *
 * @param essentiaAmount
 * @param mode
 * @return
 */
public boolean extractPowerForEssentiaTransfer( final int essentiaAmount, final Actionable mode )
{
	// Get the energy grid
	IEnergyGrid eGrid = this.getGridBlock().getEnergyGrid();

	// Ensure we have a grid
	if( eGrid == null )
	{
		return false;
	}

	// Calculate amount of power to take
	double powerDrain = EssentiaMonitor.AE_PER_ESSENTIA * essentiaAmount;

	// Extract
	return( eGrid.extractAEPower( powerDrain, mode, PowerMultiplier.CONFIG ) >= powerDrain );
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:26,代码来源:PartEssentiaStorageBus.java


示例3: onGridCacheReady

import appeng.api.networking.energy.IEnergyGrid; //导入依赖的package包/类
@MENetworkEventSubscribe
public void onGridCacheReady( final MENetworkPostCacheConstruction event )
{
	// Get the storage grid
	IStorageGrid storage = (IStorageGrid)this.internalGrid.getCache( IStorageGrid.class );

	// Wrap
	this.wrap( storage.getFluidInventory(), (IEnergyGrid)this.internalGrid.getCache( IEnergyGrid.class ), this.internalGrid );

	// Set the crafting watcher
	storage.getItemInventory().addListener( this.craftingWatcher, this.internalGrid );
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:13,代码来源:GridEssentiaCache.java


示例4: EssentiaPassThroughMonitor

import appeng.api.networking.energy.IEnergyGrid; //导入依赖的package包/类
public EssentiaPassThroughMonitor( final IMEEssentiaMonitor source, final IEnergyGrid energyGrid )
{
	// Call super
	super();

	// Set the source
	this.internalMonitor = source;

	// Set the energy grid
	this.energyGrid = energyGrid;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:12,代码来源:EssentiaPassThroughMonitor.java


示例5: wrap

import appeng.api.networking.energy.IEnergyGrid; //导入依赖的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


示例6: getEnergyGrid

import appeng.api.networking.energy.IEnergyGrid; //导入依赖的package包/类
public IEnergyGrid getEnergyGrid()
{
	// Get the grid
	IGrid grid = this.getGrid();

	// Ensure we have a grid
	if( grid == null )
	{
		return null;
	}

	// Return the energy grid
	return grid.getCache( IEnergyGrid.class );
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:15,代码来源:AEPartGridBlock.java


示例7: isPowered

import appeng.api.networking.energy.IEnergyGrid; //导入依赖的package包/类
@Override
public boolean isPowered()
{
	try
	{
		// Server side?
		if( EffectiveSide.isServerSide() && ( this.gridBlock != null ) )
		{
			// Get the energy grid
			IEnergyGrid eGrid = this.gridBlock.getEnergyGrid();
			if( eGrid != null )
			{
				this.isPowered = eGrid.isNetworkPowered();
			}
			else
			{
				this.isPowered = false;
			}
		}
	}
	catch( Exception e )
	{
		// Network unavailable, return cached value.
	}

	return this.isPowered;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:28,代码来源:ThEPartBase.java


示例8: getEnergyGrid

import appeng.api.networking.energy.IEnergyGrid; //导入依赖的package包/类
protected IEnergyGrid getEnergyGrid(IGridHost host) {
	return getCache(IEnergyGrid.class, host);
}
 
开发者ID:OpenMods,项目名称:OpenPeripheral-Integration,代码行数:4,代码来源:AdapterGridBase.java


示例9: consumeVisFromVisNetwork

import appeng.api.networking.energy.IEnergyGrid; //导入依赖的package包/类
/**
 * Requests that the interface drain vis from the relay
 *
 * @param digiVisAspect
 * @param amount
 * @return
 */
private int consumeVisFromVisNetwork( final Aspect digiVisAspect, final int amount )
{
	// Get the relay
	TileVisRelay visRelay = this.getRelay();

	// Ensure there is a relay
	if( visRelay == null )
	{
		return 0;
	}

	// Get the power grid
	IEnergyGrid eGrid = this.getGridBlock().getEnergyGrid();

	// Ensure we got the grid
	if( eGrid == null )
	{
		return 0;
	}

	// Simulate a power drain
	double drainedPower = eGrid.extractAEPower( PartVisInterface.POWER_PER_REQUESTED_VIS, Actionable.SIMULATE, PowerMultiplier.CONFIG );

	// Ensure we got the power we need
	if( drainedPower < PartVisInterface.POWER_PER_REQUESTED_VIS )
	{
		return 0;
	}

	// Ask it for vis
	int amountReceived = visRelay.consumeVis( digiVisAspect, amount );

	// Did we get any vis?
	if( amountReceived > 0 )
	{
		// Drain the power
		eGrid.extractAEPower( PartVisInterface.POWER_PER_REQUESTED_VIS, Actionable.MODULATE, PowerMultiplier.CONFIG );
	}

	// Return the amount we received
	return amountReceived;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:50,代码来源:PartVisInterface.java


示例10: extractFluid

import appeng.api.networking.energy.IEnergyGrid; //导入依赖的package包/类
/**
 * Extracts fluids from the network.
 *
 * @param target
 * @return
 */
public FluidStack extractFluid( final FluidStack target )
{
	// Get the fluid monitor
	IMEMonitor<IAEFluidStack> monitor = this.getFluidInventory();
	if( monitor == null )
	{
		return null;
	}

	// Get power grid
	IEnergyGrid eGrid = this.getEnergyGrid();
	if( eGrid == null )
	{
		return null;
	}

	// Calculate request size
	long requestSize = Math.min( target.amount, this.maxFluidRate );

	// Calculate power required
	double pwrReq = requestSize / 100;
	if( eGrid.extractAEPower( pwrReq, Actionable.SIMULATE, PowerMultiplier.CONFIG ) < pwrReq )
	{
		// Not enough power
		return null;
	}

	// Create the fluid stack
	IAEFluidStack aeRequest = AEApi.instance().storage().createFluidStack( target );

	// Set size
	aeRequest.setStackSize( requestSize );

	// Extract
	IAEFluidStack extracted = monitor.extractItems( aeRequest, Actionable.MODULATE, this.actionSource );
	if( extracted == null )
	{
		return null;
	}

	// Take power
	pwrReq = extracted.getStackSize() / 100;
	eGrid.extractAEPower( pwrReq, Actionable.MODULATE, PowerMultiplier.CONFIG );

	return extracted.getFluidStack();

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


示例11: extractAEPower

import appeng.api.networking.energy.IEnergyGrid; //导入依赖的package包/类
@Override
public double extractAEPower( final double amt, final Actionable mode, final Set<IEnergyGrid> seen )
{
	return HandlerWirelessEssentiaTerminal.this.extractPower( amt, mode );
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:6,代码来源:HandlerWirelessEssentiaTerminal.java


示例12: getEnergyDemand

import appeng.api.networking.energy.IEnergyGrid; //导入依赖的package包/类
@Override
public double getEnergyDemand( final double d, final Set<IEnergyGrid> seen )
{
	// Ignored
	return 0;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:7,代码来源:HandlerWirelessEssentiaTerminal.java


示例13: injectAEPower

import appeng.api.networking.energy.IEnergyGrid; //导入依赖的package包/类
@Override
public double injectAEPower( final double amt, final Actionable mode, final Set<IEnergyGrid> seen )
{
	// Ignored
	return amt;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:7,代码来源:HandlerWirelessEssentiaTerminal.java


示例14: EssentiaMonitor

import appeng.api.networking.energy.IEnergyGrid; //导入依赖的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 EssentiaMonitor( final IMEMonitor<IAEFluidStack> fluidMonitor, final IEnergyGrid energyGrid, final Object validationToken )
{
	// Call default constructor
	this();

	// Call wrap
	this.wrap( fluidMonitor, energyGrid, validationToken );
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:19,代码来源:EssentiaMonitor.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java JavaCodeFragment类代码示例发布时间:2022-05-23
下一篇:
Java SyncProviderInvokerTube类代码示例发布时间: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