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


Java IFluidTankProperties.getCapacity方法代码示例

本文整理汇总了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;
}
 
开发者ID:faceofcat,项目名称:Mekfarm,代码行数:27,代码来源:LiquidXPStorageEntity.java

示例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;
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:22,代码来源:PowerBarOverlayRenderHelper.java

示例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);
}
 
开发者ID:TheCBProject,项目名称:EnderStorage,代码行数:10,代码来源:TileEnderTank.java

示例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;
}
 
开发者ID:Team-IO,项目名称:taam,代码行数:10,代码来源:PipeEndFluidHandler.java


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