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


Java FluidContainerRegistry.getContainerCapacity方法代码示例

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


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

示例1: getItemStackForFluid

import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
public static ItemStack getItemStackForFluid(FluidStack fluidStack)
{
    if (fluidStack == null)
    	return null;

    ItemStack fluidContainer = null;
    
    for (FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData())
    {
        if (data.fluid.isFluidEqual(fluidStack))
        {
        	fluidContainer = data.filledContainer.copy();
        	
            int capacity = FluidContainerRegistry.getContainerCapacity(data.fluid, data.emptyContainer);
            
            if (capacity == 0) 
            	fluidContainer.stackSize = 0;
            else 
            	fluidContainer.stackSize = fluidStack.amount / capacity;
            
            break;
        }
    }
    
    return fluidContainer;
}
 
开发者ID:StrayWolfe,项目名称:Cooking-with-TFC,代码行数:27,代码来源:Helper.java

示例2: useBucket

import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
private boolean useBucket( int slot, ItemStack stack) {
	if(slot == 0 && FluidContainerRegistry.isFilledContainer(stack) && FuelRegistry.instance.isFuel(FuelType.LIQUID,FluidContainerRegistry.getFluidForFilledItem(stack).getFluid()) && tank.getFluidAmount() + FluidContainerRegistry.getContainerCapacity(stack) <= tank.getCapacity()) {
		ItemStack emptyContainer = FluidContainerRegistry.drainFluidContainer(stack);

		if(emptyContainer != null && inventory.getStackInSlot(1) == null || (emptyContainer.isItemEqual(inventory.getStackInSlot(1)) && inventory.getStackInSlot(1).stackSize < inventory.getStackInSlot(1).getMaxStackSize())) {
			tank.fill(FluidContainerRegistry.getFluidForFilledItem(stack), true);

			if(inventory.getStackInSlot(1) == null)
				super.setInventorySlotContents(1, emptyContainer);
			else
				inventory.getStackInSlot(1).stackSize++;
			decrStackSize(0, 1);
		}
		else
			return false;
	}
	else
		return false;
	
	return true;
}
 
开发者ID:zmaster587,项目名称:AdvancedRocketry,代码行数:22,代码来源:TileEntityFuelingStation.java

示例3: getContainerCapacity

import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
public static int getContainerCapacity(FluidStack fluidStack, ItemStack stackInSlot) {
    if (specialCases.containsKey(stackInSlot.getItem())) {
        ArrayList<IFluidContainerItem> iFluidContainerItems = specialCases.get(stackInSlot.getItem());
        int result = 0;
        for (IFluidContainerItem iFluidContainerItem : iFluidContainerItems) {
            result = Math.max(iFluidContainerItem.fill(stackInSlot, fluidStack, false), result);
        }
        if (result > 0) {
            return result;
        }
    }
    if (stackInSlot.getItem() instanceof IFluidContainerItem) {
        return ((IFluidContainerItem) stackInSlot.getItem()).getCapacity(stackInSlot);
    }
    else {
        return FluidContainerRegistry.getContainerCapacity(fluidStack, stackInSlot);
    }
}
 
开发者ID:TeamDmfMM,项目名称:Extra-Food,代码行数:19,代码来源:FluidContainerRegistryHelper.java

示例4: getTankProperties

import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
@Override
public IFluidTankProperties[] getTankProperties()
{
    FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(container);
    int capacity = FluidContainerRegistry.getContainerCapacity(fluid, container);
    return new FluidTankProperties[] { new FluidTankProperties(fluid, capacity) };
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:8,代码来源:FluidContainerRegistryWrapper.java


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