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


Java IFluidTank.getFluid方法代码示例

本文整理汇总了Java中net.minecraftforge.fluids.IFluidTank.getFluid方法的典型用法代码示例。如果您正苦于以下问题:Java IFluidTank.getFluid方法的具体用法?Java IFluidTank.getFluid怎么用?Java IFluidTank.getFluid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.fluids.IFluidTank的用法示例。


在下文中一共展示了IFluidTank.getFluid方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: extractFluidsFromTanks

import net.minecraftforge.fluids.IFluidTank; //导入方法依赖的package包/类
public static void extractFluidsFromTanks(List<IFluidTank> tanks, List<FluidStack> fluids)
{
    LinkedList<IFluidTank> remaining = Lists.newLinkedList(tanks);

    for (FluidStack stack : fluids)
    {
        for (Iterator<IFluidTank> iterator = remaining.iterator(); iterator.hasNext(); )
        {
            IFluidTank tank = iterator.next();
            if (tank.getFluid() != null && tank.getFluid().getFluid().getName().equals(stack.getFluid().getName()))
            {
                FluidStack drained = tank.drain(stack.amount, false);
                if (drained != null && drained.amount == stack.amount)
                {
                    tank.drain(stack.amount, true);
                    iterator.remove();
                    break;
                }
            }
        }
    }
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:23,代码来源:ItemHelper.java

示例2: detectAndSendChanges

import net.minecraftforge.fluids.IFluidTank; //导入方法依赖的package包/类
@Override
public void detectAndSendChanges()
{
    super.detectAndSendChanges();

    for (int i = 0; i < tanks.size(); i++)
    {
        IFluidTank tank = tanks.get(i);

        FluidStack prev = fluidStacks.get(i);
        FluidStack current = tank.getFluid();

        if (!ItemHelper.fluidStackEqual(prev, current))
        {
            PacketSyncContainerFluid packet = new PacketSyncContainerFluid(windowId, i, current);
            for (IContainerListener listener : listeners)
            {
                if (listener instanceof EntityPlayerMP)
                {
                    EntityPlayerMP player = (EntityPlayerMP) listener;
                    CustomStuff4.network.sendTo(packet, player);
                }
            }

            fluidStacks.set(i, current == null ? null : current.copy());
        }
    }
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:29,代码来源:ContainerCS4.java

示例3: drawFluidTank

import net.minecraftforge.fluids.IFluidTank; //导入方法依赖的package包/类
public void drawFluidTank(IFluidTank tank, int x, int y) {
	FluidStack fluid = tank.getFluid();
	TextureManager manager = Minecraft.getMinecraft().renderEngine;
	if (fluid != null) {
		manager.bindTexture(manager.getResourceLocation(0));
		float amount = fluid.amount;
		float capacity = tank.getCapacity();
		float scale = amount / capacity;
		int fluidTankHeight = 60;
		int fluidAmount = (int) (scale * fluidTankHeight);
		drawFluid(x, y + fluidTankHeight - fluidAmount, fluid.getFluid().getIcon(fluid), 16, fluidAmount);
	}
}
 
开发者ID:austinv11,项目名称:DartCraft2,代码行数:14,代码来源:GuiInfuser.java

示例4: drawFluidTank

import net.minecraftforge.fluids.IFluidTank; //导入方法依赖的package包/类
public void drawFluidTank(IFluidTank tank, int x, int y)
{
    FluidStack fluid = tank.getFluid();
    TextureManager manager = Minecraft.getMinecraft().renderEngine;
    if (fluid != null)
    {
        manager.bindTexture(manager.getResourceLocation(0));
        float amount = fluid.amount;
        float capacity = tank.getCapacity();
        float scale = amount / capacity;
        int fluidTankHeight = 60;
        int fluidAmount = (int) (scale * fluidTankHeight);
        drawFluid(x, y + fluidTankHeight - fluidAmount, fluid.getFluid().getIcon(fluid), 16, fluidAmount);
    }
}
 
开发者ID:GrandPanda,项目名称:A-Cup-of-Java,代码行数:16,代码来源:GuiCoffeeGenerator.java

示例5: MB

import net.minecraftforge.fluids.IFluidTank; //导入方法依赖的package包/类
public static @Nonnull String MB(IFluidTank tank) {
  if (tank == null) {
    return MB(0, 0);
  }
  FluidStack fluid = tank.getFluid();
  if (fluid != null) {
    return MB(fluid, tank.getCapacity());
  }
  return MB(tank.getFluidAmount(), tank.getCapacity());
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:11,代码来源:LangFluid.java

示例6: setInfo

import net.minecraftforge.fluids.IFluidTank; //导入方法依赖的package包/类
public void setInfo(IFluidTank tank) {
	capacity = tank.getCapacity();
	fluid = tank.getFluid();
}
 
开发者ID:Team-IO,项目名称:taam,代码行数:5,代码来源:TankRenderInfo.java


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