本文整理汇总了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;
}
}
}
}
}
示例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());
}
}
}
示例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);
}
}
示例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);
}
}
示例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());
}
示例6: setInfo
import net.minecraftforge.fluids.IFluidTank; //导入方法依赖的package包/类
public void setInfo(IFluidTank tank) {
capacity = tank.getCapacity();
fluid = tank.getFluid();
}