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


Java IFluidContainerItem.getFluid方法代码示例

本文整理汇总了Java中net.minecraftforge.fluids.IFluidContainerItem.getFluid方法的典型用法代码示例。如果您正苦于以下问题:Java IFluidContainerItem.getFluid方法的具体用法?Java IFluidContainerItem.getFluid怎么用?Java IFluidContainerItem.getFluid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.fluids.IFluidContainerItem的用法示例。


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

示例1: getFluidContainerContents

import net.minecraftforge.fluids.IFluidContainerItem; //导入方法依赖的package包/类
private String getFluidContainerContents(ItemStack pItemInQuestion)
{
    String tResult = "No fluid container";
    
    if (pItemInQuestion.getItem() instanceof IFluidContainerItem)
    {
        IFluidContainerItem tFluidContainer = IFluidContainerItem.class.cast(pItemInQuestion.getItem());
        FluidStack tContents = tFluidContainer.getFluid(pItemInQuestion);
        if (tContents != null)
        {
            tResult = String.format("FluidID: [%d], UnlocName: [%s], Name: [%s]", tContents.getFluid().getID(), tContents.getFluid().getUnlocalizedName(), tContents.getFluid().getName()); 
        }
    }
    
    return tResult;
}
 
开发者ID:GTNewHorizons,项目名称:NewHorizonsCoreMod,代码行数:17,代码来源:ItemInHandInfoCommand.java

示例2: extractFluid

import net.minecraftforge.fluids.IFluidContainerItem; //导入方法依赖的package包/类
public static FluidStack extractFluid(int needed, ItemStack container, Fluid fluid)
{
	IFluidContainerItem item = (IFluidContainerItem)container.getItem();
	
	if(item.getFluid(container) == null)
	{
		return null;
	}
	
	if(fluid != null && item.getFluid(container).getFluid() != fluid)
	{
		return null;
	}
	
	return item.drain(container, needed, true);
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:17,代码来源:FluidContainerUtils.java

示例3: getFluidStackFromContainer

import net.minecraftforge.fluids.IFluidContainerItem; //导入方法依赖的package包/类
/**
 * Get the fluidStack of given itemStack, if there is any.
 * returns null if itemstack is null or not a fluid container
 * 
 * @param pItemStack
 * @return
 */
public static FluidStack getFluidStackFromContainer( ItemStack pItemStack )
{
  FluidStack tReturnVal = null;

  if( (Object) pItemStack.getItem() instanceof IFluidContainerItem )
  {
    IFluidContainerItem tFluidContainer = IFluidContainerItem.class.cast( pItemStack.getItem() );
    FluidStack tContents = tFluidContainer.getFluid( pItemStack );
    if( tContents != null )
    {
      tReturnVal = tContents;
    }
  }

  return tReturnVal;
}
 
开发者ID:GTNewHorizons,项目名称:Yamcl,代码行数:24,代码来源:FluidHelper.java

示例4: matches

import net.minecraftforge.fluids.IFluidContainerItem; //导入方法依赖的package包/类
@Override
public boolean matches(ItemStack subject) {
	FluidStack fs = FluidContainerRegistry.getFluidForFilledItem(subject);

	if (fs == null && subject.getItem() instanceof IFluidContainerItem) {
		IFluidContainerItem item = (IFluidContainerItem)subject.getItem();
		fs = item.getFluid(subject);
	}

	// match amount precisely to avoid having to deal with leftover
	return fs == null && fluid == null ||
			fs != null && fs.getFluid() == fluid && fs.amount >= amount;
}
 
开发者ID:Herobone,项目名称:HeroUtils,代码行数:14,代码来源:RecipeInputFluidContainer.java

示例5: getMeta

import net.minecraftforge.fluids.IFluidContainerItem; //导入方法依赖的package包/类
@Override
public Object getMeta(IFluidContainerItem target, ItemStack stack) {
	FluidStack fluidStack = target.getFluid(stack);
	if (fluidStack != null && fluidStack.amount > 0) {
		int heatPerBucket = FuelManager.getBoilerFuelValue(fluidStack.getFluid());
		if (heatPerBucket > 0) {
			Map<String, Number> result = Maps.newHashMap();
			result.put("total", heatPerBucket / 1000.0f * fluidStack.amount);
			result.put("per_bucket", heatPerBucket);
			return result;
		}
	}

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

示例6: isEmptyComplexContainer

import net.minecraftforge.fluids.IFluidContainerItem; //导入方法依赖的package包/类
protected boolean isEmptyComplexContainer(ItemStack item) {
	if (item == null) return false;

	if (item.getItem() instanceof IFluidContainerItem) {
		IFluidContainerItem container = (IFluidContainerItem) item.getItem();
		FluidStack containerFluid = container.getFluid(item);

		return (containerFluid == null || containerFluid.amount == 0);
	}

	return false;
}
 
开发者ID:hockeyhurd,项目名称:Project-Zed,代码行数:13,代码来源:AbstractBlockTankBase.java


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