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

Java Actionable类代码示例

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

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



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

示例1: addEssentia

import appeng.api.config.Actionable; //导入依赖的package包/类
@Override
public int addEssentia( final Aspect aspect, final int amount, final ForgeDirection side, final Actionable mode )
{
	// Assume its all rejected
	long rejectedAmount = amount;

	// Ensure we have a monitor
	if( this.getEssentiaMonitor() )
	{
		// Inject essentia
		rejectedAmount = this.monitor.injectEssentia( aspect, amount, mode, this.getMachineSource(), true );
	}

	// Calculate the accepted amount
	long acceptedAmount = amount - rejectedAmount;

	if( ( mode == Actionable.MODULATE ) && ( acceptedAmount > 0 ) )
	{
		this.tickRate = TileEssentiaProvider.TICK_RATE_URGENT;
	}

	return (int)acceptedAmount;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:24,代码来源:TileEssentiaProvider.java


示例2: extractPowerForEssentiaTransfer

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

import appeng.api.config.Actionable; //导入依赖的package包/类
/**
 * Inserts essentia into the network.
 *
 * @param aspect
 * @param amount
 * @return Amount injected
 */
public long insertEssentia( final Aspect aspect, final int amount )
{
	// Get the essentia monitor
	IMEEssentiaMonitor monitor = this.getEssentiaInventory();
	if( monitor == null )
	{
		return 0;
	}

	// Calculate the amount to inject
	int amountToInject = Math.min( amount, this.maxEssentiaRate );

	// Attempt to inject
	long amountRejected = monitor.injectEssentia( aspect, amountToInject, Actionable.MODULATE, this.actionSource, true );

	// Return the amount that was injected
	return amountToInject - amountRejected;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:26,代码来源:AIAENetworkGolem.java


示例4: extractItems

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

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


示例6: extractItems

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


示例7: injectItems

import appeng.api.config.Actionable; //导入依赖的package包/类
@Override
public StackType injectItems(StackType input, Actionable mode, BaseActionSource src)
{
	if ( mode == Actionable.SIMULATE )
		return getHandler().injectItems( input, mode, src );
	return monitorDifference(input.copy(), getHandler().injectItems(input, mode, src), false, src);
}
 
开发者ID:amadornes,项目名称:Framez,代码行数:8,代码来源:MEMonitorHandler.java


示例8: extractItems

import appeng.api.config.Actionable; //导入依赖的package包/类
@Override
public StackType extractItems(StackType request, Actionable mode, BaseActionSource src)
{
	if ( mode == Actionable.SIMULATE )
		return getHandler().extractItems( request, mode, src );
	return monitorDifference(request.copy(), getHandler().extractItems(request, mode, src), true, src);
}
 
开发者ID:amadornes,项目名称:Framez,代码行数:8,代码来源:MEMonitorHandler.java


示例9: extractItems

import appeng.api.config.Actionable; //导入依赖的package包/类
@Override
public StackType extractItems(StackType request, Actionable mode, BaseActionSource src)
{
	if ( mode == Actionable.SIMULATE )
		return this.getHandler().extractItems( request, mode, src );
	return this.monitorDifference(request.copy(), this.getHandler().extractItems(request, mode, src), true, src);
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:8,代码来源:MEMonitorHandler.java


示例10: injectItems

import appeng.api.config.Actionable; //导入依赖的package包/类
@Override
public StackType injectItems(StackType input, Actionable mode, BaseActionSource src) {
    if (mode == Actionable.SIMULATE) {
        return getHandler().injectItems(input, mode, src);
    }
    return monitorDiffrence((StackType) input.copy(), getHandler().injectItems(input, mode, src), false, src);
}
 
开发者ID:AgileMods,项目名称:MateriaMuto,代码行数:8,代码来源:MEMonitorHandler.java


示例11: extractItems

import appeng.api.config.Actionable; //导入依赖的package包/类
@Override
public StackType extractItems(StackType request, Actionable mode, BaseActionSource src) {
    if (mode == Actionable.SIMULATE) {
        return getHandler().extractItems(request, mode, src);
    }
    return monitorDiffrence((StackType) request.copy(), getHandler().extractItems(request, mode, src), true, src);
}
 
开发者ID:AgileMods,项目名称:MateriaMuto,代码行数:8,代码来源:MEMonitorHandler.java


示例12: extractFromContainer

import appeng.api.config.Actionable; //导入依赖的package包/类
/**
 * Extracts essentia from a container based on the specified fluid stack
 * type and amount.
 *
 * @param container
 * @param request
 * @param mode
 * @return
 */
public FluidStack extractFromContainer( final IAspectContainer container, final FluidStack request, final Actionable mode )
{
	// Ensure there is a request
	if( ( request == null ) || ( request.getFluid() == null ) || ( request.amount == 0 ) )
	{
		// No request
		return null;
	}

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

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

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

	// Get the amount to extract
	long amountToDrain_EU = EssentiaConversionHelper.INSTANCE.convertFluidAmountToEssentiaAmount( request.amount );

	// Extract
	long extractedAmount_EU = this.extractFromContainer( container, (int)amountToDrain_EU, gasAspect, mode );

	// Was any extracted?
	if( extractedAmount_EU <= 0 )
	{
		// None extracted
		return null;
	}

	// Return the extracted amount
	return new FluidStack( fluid, (int)EssentiaConversionHelper.INSTANCE.convertEssentiaAmountToFluidAmount( extractedAmount_EU ) );
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:48,代码来源:EssentiaTileContainerHelper.java


示例13: injectFluidIntoContainer

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


示例14: extractEssentia

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


示例15: injectEssentia

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


示例16: injectEssentiaSafely

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


示例17: extractEssentia

import appeng.api.config.Actionable; //导入依赖的package包/类
/**
 * Extracts essentia from the network.
 *
 * @param aspect
 * @param amount
 * @param mode
 * @return The amount extracted.
 */
public long extractEssentia( final Aspect aspect, final int amount, final Actionable mode )
{
	// Get the essentia monitor
	IMEEssentiaMonitor monitor = this.getEssentiaInventory();
	if( monitor == null )
	{
		return 0;
	}

	return monitor.extractEssentia( aspect, Math.min( amount, this.maxEssentiaRate ), mode, this.actionSource, mode == Actionable.MODULATE );

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


示例18: extractItems

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


示例19: injectItems

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

import appeng.api.config.Actionable; //导入依赖的package包/类
/**
 * Uses some of the terminals stored power. This does take into account the extra power required for wireless operations.
 *
 * @param amount
 * @return Returns the amount extracted.
 */
public double extractPower( final double amount, final Actionable mode )
{
	// Has power usage been disabled?
	if( ItemWirelessEssentiaTerminal.GLOBAL_POWER_MULTIPLIER == 0 )
	{
		// Lie and say it was taken.
		return amount;
	}

	// Adjust by the power multiplier
	double adjustedAmount = amount * this.wirelessPowerMultiplier;

	double extractedAmount = 0;
	// Simulation?
	if( mode == Actionable.SIMULATE )
	{
		// Return the amount stored, capped at amount
		extractedAmount = Math.min( this.wirelessTerminal.getAECurrentPower( this.wirelessItemstack ), adjustedAmount );
	}
	else
	{
		// Return the amount extracted.
		extractedAmount = this.wirelessTerminal.extractAEPower( this.wirelessItemstack, adjustedAmount );
	}

	// Adjust by the power multiplier
	extractedAmount /= this.wirelessPowerMultiplier;

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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