本文整理汇总了Java中net.minecraftforge.fluids.capability.IFluidTankProperties.getCapacity方法的典型用法代码示例。如果您正苦于以下问题:Java IFluidTankProperties.getCapacity方法的具体用法?Java IFluidTankProperties.getCapacity怎么用?Java IFluidTankProperties.getCapacity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.fluids.capability.IFluidTankProperties
的用法示例。
在下文中一共展示了IFluidTankProperties.getCapacity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isValidOutContainer
import net.minecraftforge.fluids.capability.IFluidTankProperties; //导入方法依赖的package包/类
private boolean isValidOutContainer(ItemStack stack) {
if (!ItemStackUtil.isEmpty(stack)) {
Item item = stack.getItem();
if ((item == Items.GLASS_BOTTLE) || (item == Items.BUCKET)) {
return true;
}
if (stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) {
IFluidHandlerItem handler = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
if (handler != null) {
IFluidTankProperties[] tanks = handler.getTankProperties();
if ((tanks != null) && (tanks.length > 0)) {
for(IFluidTankProperties tank: tanks) {
if (tank.canFill()) {
FluidStack content = tank.getContents();
if ((content == null) || ((content.amount < tank.getCapacity()) && (content.getFluid() == FluidsRegistry.liquidXP))) {
return true;
}
}
}
}
}
}
}
return false;
}
示例2: render
import net.minecraftforge.fluids.capability.IFluidTankProperties; //导入方法依赖的package包/类
public boolean render(@Nonnull ItemStack stack, int xPosition, int yPosition, int barOffset, boolean alwaysShow) {
IFluidHandler cap = FluidUtil.getFluidHandlerCapability(stack);
if (cap == null || cap.getTankProperties() == null || cap.getTankProperties().length <= 0) {
return false;
}
IFluidTankProperties tank = cap.getTankProperties()[0];
if (tank == null || tank.getCapacity() <= 0) {
return false;
}
int maxFluid = tank.getCapacity();
FluidStack fluidStack = tank.getContents();
int fluidAmount = fluidStack == null ? 0 : fluidStack.amount;
if (alwaysShow || shouldShowBar(maxFluid, fluidAmount)) {
double level = (double) fluidAmount / (double) maxFluid;
boolean up = stack.getItem().showDurabilityBar(stack);
boolean top = stack.getCount() != 1;
render(level, xPosition, yPosition, top ? 12 - barOffset : up ? 2 + barOffset : barOffset, (barOffset & 1) == 0);
return true;
}
return false;
}
示例3: comparatorInput
import net.minecraftforge.fluids.capability.IFluidTankProperties; //导入方法依赖的package包/类
@Override
public int comparatorInput() {
IFluidTankProperties tank = getStorage().getTankProperties()[0];
FluidStack fluid = tank.getContents();
if (fluid == null) {
fluid = FluidUtils.emptyFluid();
}
return fluid.amount * 14 / tank.getCapacity() + (fluid.amount > 0 ? 1 : 0);
}
示例4: getCapacity
import net.minecraftforge.fluids.capability.IFluidTankProperties; //导入方法依赖的package包/类
@Override
public int getCapacity() {
IFluidTankProperties[] tankInfo = fluidHandler.getTankProperties();
int capacity = 0;
for (IFluidTankProperties tank : tankInfo) {
capacity += tank.getCapacity();
}
return capacity;
}