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


Java IAspectContainer类代码示例

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


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

示例1: addAspectContainerTileToExtractPermissions

import thaumcraft.api.aspects.IAspectContainer; //导入依赖的package包/类
@Override
public <T extends TileEntity & IAspectContainer> boolean addAspectContainerTileToExtractPermissions(	final Class<T> tileClass,
																										final int capacity )
{
	// Ensure we have a tile
	if( tileClass != null )
	{
		// Set capacity
		this.tileCapacities.put( tileClass, capacity );

		// Is it not already registered?
		if( this.tileExtractWhiteList.add( tileClass ) )
		{
			// Log the addition
			ThELog.info( "Added \"%s\" with capacity (%d) to extraction whitelist.", tileClass.toString(), capacity );
		}

		return true;
	}

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

示例2: addAspectContainerTileToInjectPermissions

import thaumcraft.api.aspects.IAspectContainer; //导入依赖的package包/类
@Override
public <T extends TileEntity & IAspectContainer> boolean addAspectContainerTileToInjectPermissions( final Class<T> tileClass, final int capacity )
{
	// Ensure we have a tile
	if( tileClass != null )
	{
		// Set capacity
		this.tileCapacities.put( tileClass, capacity );

		// Is it not already registered?
		if( this.tileInjectWhiteList.add( tileClass ) )
		{
			// Log the addition
			ThELog.info( "Added \"%s\" with capacity (%d) to injection whitelist.", tileClass.toString(), capacity );
		}

		return true;
	}

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

示例3: addInformation

import thaumcraft.api.aspects.IAspectContainer; //导入依赖的package包/类
@Override
public void addInformation(World world, int x, int y, int z, TileEntity te, List<String> infoList){
    if(te instanceof IAspectContainer) {
        IAspectContainer container = (IAspectContainer)te;
        AspectList aspects = container.getAspects();
        if(aspects != null && aspects.size() > 0) {
            infoList.add("blockTracker.info.thaumcraft");
            for(Map.Entry<Aspect, Integer> entry : aspects.aspects.entrySet()) {
                infoList.add("-" + entry.getValue() + "x " + entry.getKey().getName());
            }
        } else {
            infoList.add(I18n.format("blockTracker.info.thaumcraft") + " -");
        }
        if(container instanceof INode) {
            INode node = (INode)container;
            infoList.add(I18n.format("blockTracker.info.thaumcraft.nodetype") + " " + I18n.format("nodetype." + node.getNodeType() + ".name"));
            if(node.getNodeModifier() != null) infoList.add(I18n.format("blockTracker.info.thaumcraft.nodeModifier") + " " + I18n.format("nodemod." + node.getNodeModifier() + ".name"));
        }
    }
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:21,代码来源:BlockTrackEntryThaumcraft.java

示例4: block

import thaumcraft.api.aspects.IAspectContainer; //导入依赖的package包/类
@ScriptCallable(returnTypes = ReturnType.TABLE, description = "Get the map of aspects stored in the block (summed, if there are multiple entries)")
public Map<String, Integer> getAspectsSum(IAspectContainer container) {
	AspectList aspectList = container.getAspects();
	if (aspectList == null) return null;
	Map<String, Integer> result = Maps.newHashMap();
	for (Aspect aspect : aspectList.getAspects()) {
		if (aspect == null) continue;
		String name = aspect.getName();
		int amount = Objects.firstNonNull(result.get(name), 0);
		result.put(name, amount + aspectList.getAmount(aspect));
	}
	return result;
}
 
开发者ID:OpenMods,项目名称:OpenPeripheral-Integration,代码行数:14,代码来源:AdapterAspectContainer.java

示例5: getAspectCount

import thaumcraft.api.aspects.IAspectContainer; //导入依赖的package包/类
@ScriptCallable(returnTypes = ReturnType.NUMBER, description = "Get amount of specific aspect stored in this block")
public int getAspectCount(IAspectContainer container,
		@Arg(name = "aspect", description = "Aspect to be checked") String aspectName) {

	Aspect aspect = Aspect.getAspect(aspectName.toLowerCase(Locale.ENGLISH));
	Preconditions.checkNotNull(aspect, "Invalid aspect name");
	AspectList list = container.getAspects();
	if (list == null) return 0;
	return list.getAmount(aspect);
}
 
开发者ID:OpenMods,项目名称:OpenPeripheral-Integration,代码行数:11,代码来源:AdapterAspectContainer.java

示例6: getAspects

import thaumcraft.api.aspects.IAspectContainer; //导入依赖的package包/类
@ScriptCallable(returnTypes = ReturnType.TABLE, description = "Get the Aspects stored in the block")
public List<Map<String, Object>> getAspects(IAspectContainer container) {
	List<Map<String, Object>> result = ConverterAspectList.aspectsToMap(container.getAspects());
	if (result.isEmpty()) {
		Aspect filter = ASPECT_FILTER.get(container);
		if (filter != null) ConverterAspectList.appendAspectEntry(result, filter, 0);
	}

	return result;
}
 
开发者ID:OpenMods,项目名称:OpenPeripheral-Integration,代码行数:11,代码来源:AdapterJar.java

示例7: addAspectContainerTileToBothPermissions

import thaumcraft.api.aspects.IAspectContainer; //导入依赖的package包/类
@Override
public <T extends TileEntity & IAspectContainer> boolean addAspectContainerTileToBothPermissions( final Class<T> tileClass, final int capacity )
{
	// Add to both
	return( this.addAspectContainerTileToInjectPermissions( tileClass, capacity ) | this.addAspectContainerTileToExtractPermissions( tileClass,
		capacity ) );
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:8,代码来源:ThETransportPermissions.java

示例8: getAspectContainerTileCapacity

import thaumcraft.api.aspects.IAspectContainer; //导入依赖的package包/类
@Override
public int getAspectContainerTileCapacity( final IAspectContainer container )
{
	// Is the capacity registered?
	if( this.tileCapacities.containsKey( container.getClass() ) )
	{
		return this.tileCapacities.get( container.getClass() );
	}

	return -1;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:12,代码来源:ThETransportPermissions.java

示例9: extractFromContainer

import thaumcraft.api.aspects.IAspectContainer; //导入依赖的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

示例10: getAspectInContainer

import thaumcraft.api.aspects.IAspectContainer; //导入依赖的package包/类
/**
 * Returns the aspect of the essentia in the container.
 *
 * @param container
 * @return
 */
public Aspect getAspectInContainer( final IAspectContainer container )
{
	// Get the aspect list from the container
	IAspectStack containerStack = this.getAspectStackFromContainer( container );

	// Did we get a stack?
	if( containerStack == null )
	{
		return null;
	}

	return containerStack.getAspect();
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:20,代码来源:EssentiaTileContainerHelper.java

示例11: getAspectStackFromContainer

import thaumcraft.api.aspects.IAspectContainer; //导入依赖的package包/类
public IAspectStack getAspectStackFromContainer( final IAspectContainer container )
{
	// Ensure we have a container
	if( container == null )
	{
		return null;
	}

	// Get the list of aspects in the container
	AspectList aspectList = container.getAspects();

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

	// Create the stack
	IAspectStack aspectStack = new AspectStack();

	// Set the aspect
	aspectStack.setAspect( aspectList.getAspectsSortedAmount()[0] );

	if( !aspectStack.hasAspect() )
	{
		return null;
	}

	// Set the amount
	aspectStack.setStackSize( aspectList.getAmount( aspectStack.getAspect() ) );

	return aspectStack;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:33,代码来源:EssentiaTileContainerHelper.java

示例12: getAspectStacksFromContainer

import thaumcraft.api.aspects.IAspectContainer; //导入依赖的package包/类
/**
 * Gets the list of aspects in the container.
 *
 * @param container
 * @return
 */
public List<IAspectStack> getAspectStacksFromContainer( final IAspectContainer container )
{
	List<IAspectStack> stacks = new ArrayList<IAspectStack>();

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

	// Get the list of aspects in the container
	AspectList aspectList = container.getAspects();

	if( aspectList == null )
	{
		return stacks;
	}

	// Populate the list
	for( Entry<Aspect, Integer> essentia : aspectList.aspects.entrySet() )
	{
		if( ( essentia != null ) && ( essentia.getValue() != 0 ) )
		{
			stacks.add( new AspectStack( essentia.getKey(), essentia.getValue() ) );
		}
	}

	return stacks;

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

示例13: getContainerStoredAmount

import thaumcraft.api.aspects.IAspectContainer; //导入依赖的package包/类
public int getContainerStoredAmount( final IAspectContainer container )
{
	int stored = 0;

	// Get the essentia list
	for( IAspectStack essentia : this.getAspectStacksFromContainer( container ) )
	{
		if( essentia != null )
		{
			stored += (int)essentia.getStackSize();
		}
	}

	return stored;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:16,代码来源:EssentiaTileContainerHelper.java

示例14: injectFluidIntoContainer

import thaumcraft.api.aspects.IAspectContainer; //导入依赖的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

示例15: onNeighborChanged

import thaumcraft.api.aspects.IAspectContainer; //导入依赖的package包/类
@Override
public void onNeighborChanged()
{
	// Ignored client side
	if( EffectiveSide.isClientSide() )
	{
		return;
	}

	// Set that we are not facing a container
	this.facingContainer = null;

	// Get the tile we are facing
	TileEntity tileEntity = this.getFacingTile();

	// Are we facing a container?
	if( tileEntity instanceof IAspectContainer )
	{
		this.facingContainer = (IAspectContainer)tileEntity;
	}

	// Is the bus pulse controlled?
	if( this.redstoneMode == RedstoneMode.SIGNAL_PULSE )
	{
		// Did the state of the redstone change?
		if( this.isReceivingRedstonePower() != this.lastRedstone )
		{
			// Set the previous redstone state
			this.lastRedstone = this.isReceivingRedstonePower();

			// Do work
			this.doWork( this.getTransferAmountPerSecond() );
		}
	}
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:36,代码来源:ThEPartEssentiaIOBus_Base.java


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