本文整理匯總了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;
}
示例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;
}
示例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);
}
}
示例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) };
}