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

Java PowerMultiplier类代码示例

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

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



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

示例1: extractPowerForEssentiaTransfer

import appeng.api.config.PowerMultiplier; //导入依赖的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


示例2: extractEssentia

import appeng.api.config.PowerMultiplier; //导入依赖的package包/类
@Override
public long extractEssentia( final Aspect aspect, final long amount, final Actionable mode, final BaseActionSource source, final boolean powered )
{
	if( powered )
	{
		// Simulate power extraction
		double powerRequest = EssentiaMonitor.AE_PER_ESSENTIA * amount;
		double powerReceived = this.energyGrid.extractAEPower( powerRequest, Actionable.SIMULATE, PowerMultiplier.CONFIG );

		// Was enough power extracted?
		if( powerReceived < powerRequest )
		{
			// Not enough power
			return 0;
		}
	}

	// Extract
	long extractedAmount = this.internalMonitor.extractEssentia( aspect, amount, mode, source, false );

	// Extract power if modulating
	if( ( extractedAmount > 0 ) && ( powered ) && ( mode == Actionable.MODULATE ) )
	{
		this.energyGrid.extractAEPower( EssentiaMonitor.AE_PER_ESSENTIA * extractedAmount, Actionable.MODULATE, PowerMultiplier.CONFIG );
	}

	return extractedAmount;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:29,代码来源:EssentiaPassThroughMonitor.java


示例3: injectEssentia

import appeng.api.config.PowerMultiplier; //导入依赖的package包/类
@Override
public long injectEssentia( final Aspect aspect, final long amount, final Actionable mode, final BaseActionSource source, final boolean powered )
{
	if( powered )
	{
		// Simulate power extraction
		double powerRequest = EssentiaMonitor.AE_PER_ESSENTIA * amount;
		double powerReceived = this.energyGrid.extractAEPower( powerRequest, Actionable.SIMULATE, PowerMultiplier.CONFIG );

		// Was enough power extracted?
		if( powerReceived < powerRequest )
		{
			// Not enough power
			return 0;
		}
	}

	// Inject
	long rejectedAmount = this.internalMonitor.injectEssentia( aspect, amount, mode, source, false );
	long injectedAmount = amount - rejectedAmount;

	// Extract power if modulating
	if( ( injectedAmount > 0 ) && ( powered ) && ( mode == Actionable.MODULATE ) )
	{
		this.energyGrid.extractAEPower( EssentiaMonitor.AE_PER_ESSENTIA * injectedAmount, Actionable.MODULATE, PowerMultiplier.CONFIG );
	}

	return rejectedAmount;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:30,代码来源:EssentiaPassThroughMonitor.java


示例4: extractAEPower

import appeng.api.config.PowerMultiplier; //导入依赖的package包/类
@Override
public double extractAEPower(double amt, Actionable mode, PowerMultiplier usePowerMultiplier) {

    return 0;
}
 
开发者ID:amadornes,项目名称:Framez,代码行数:6,代码来源:MotorModifierAE2.java


示例5: extractEssentia

import appeng.api.config.PowerMultiplier; //导入依赖的package包/类
@Override
public long extractEssentia( final Aspect aspect, final long amount, final Actionable mode, final BaseActionSource source, final boolean powered )
{
	// Ensure the aspect is not null, and the amount is > 0
	if( ( aspect == null ) || ( amount <= 0 ) )
	{
		// Invalid arguments
		return 0;
	}

	// Get the gas form of the essentia
	GaseousEssentia essentiaGas;

	// Ensure there is a gas form of the aspect.
	if( ( essentiaGas = GaseousEssentia.getGasFromAspect( aspect ) ) == null )
	{
		// Unregistered aspect :(
		return 0;
	}

	if( powered )
	{
		// Simulate power extraction
		double powerRequest = EssentiaMonitor.AE_PER_ESSENTIA * amount;
		double powerReceived = this.energyGrid.extractAEPower( powerRequest, Actionable.SIMULATE, PowerMultiplier.CONFIG );

		// Was enough power extracted?
		if( powerReceived < powerRequest )
		{
			// Not enough power
			return 0;
		}
	}

	// Create the fluid request
	IAEFluidStack fluidRequest = EssentiaConversionHelper.INSTANCE.createAEFluidStackInEssentiaUnits( essentiaGas, amount );

	// Attempt the extraction
	IAEFluidStack fluidReceived = this.fluidMonitor.extractItems( fluidRequest, mode, source );

	// Was any fluid received?
	if( ( fluidReceived == null ) || ( fluidReceived.getStackSize() <= 0 ) )
	{
		// Fluid not found.
		return 0;
	}

	// Convert the received fluid into an aspect stack
	long extractedAmount = EssentiaConversionHelper.INSTANCE.convertFluidAmountToEssentiaAmount( fluidReceived.getStackSize() );

	// Extract power if modulating
	if( ( powered ) && ( mode == Actionable.MODULATE ) )
	{
		this.energyGrid.extractAEPower( EssentiaMonitor.AE_PER_ESSENTIA * extractedAmount, Actionable.MODULATE, PowerMultiplier.CONFIG );
	}

	return extractedAmount;

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


示例6: consumeVisFromVisNetwork

import appeng.api.config.PowerMultiplier; //导入依赖的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


示例7: extractFluid

import appeng.api.config.PowerMultiplier; //导入依赖的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


示例8: extractAEPower

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


示例9: extractAEPower

import appeng.api.config.PowerMultiplier; //导入依赖的package包/类
/**
 * Extract power from the network.
 * 
 * @param amt extracted power
 * @param mode should the action be simulated or performed?
 * @return returns extracted power.
 */
public double extractAEPower(double amt, Actionable mode, PowerMultiplier usePowerMultiplier);
 
开发者ID:amadornes,项目名称:Framez,代码行数:9,代码来源:IEnergySource.java


示例10: extractAEPower

import appeng.api.config.PowerMultiplier; //导入依赖的package包/类
/**
 * Extract power from the network.
 *
 * @param amt
 * @param mode
 *            should the action be simulated or performed?
 * @return returns extracted power.
 */
public double extractAEPower(double amt, Actionable mode, PowerMultiplier usePowerMultiplier);
 
开发者ID:AgileMods,项目名称:MateriaMuto,代码行数:10,代码来源:IEnergySource.java


示例11: extractAEPower

import appeng.api.config.PowerMultiplier; //导入依赖的package包/类
/**
 * Extract power from the network.
 *
 * @param amt  extracted power
 * @param mode should the action be simulated or performed?
 *
 * @return returns extracted power.
 */
double extractAEPower( double amt, Actionable mode, PowerMultiplier usePowerMultiplier );
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:10,代码来源:IEnergySource.java


示例12: extractAEPower

import appeng.api.config.PowerMultiplier; //导入依赖的package包/类
/**
 * Extract power from the network.
 * 
 * @param amt
 * @param mode
 *            should the action be simulated or performed?
 * @return returns extracted power.
 */
public double extractAEPower(double amt, Actionable mode, PowerMultiplier usePowerMultiplier);
 
开发者ID:Lomeli12,项目名称:Equivalency,代码行数:10,代码来源:IEnergySource.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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