當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。