本文整理汇总了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) };
}