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


Java IFluidTank.getFluidAmount方法代码示例

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


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

示例1: render

import net.minecraftforge.fluids.IFluidTank; //导入方法依赖的package包/类
@Override
public void render(TileEntityPlasticMixer te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
    IFluidTank tank = te.getTank();
    if (tank.getFluidAmount() == 0) return;

    GlStateManager.pushMatrix();
    GlStateManager.translate(x, y, z);
    GlStateManager.enableBlend();
    GlStateManager.disableAlpha();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);

    AxisAlignedBB bounds = getRenderBounds(tank);
    PneumaticCraftUtils.renderFluid(tank.getFluid().getFluid(), bounds);

    GlStateManager.disableBlend();
    GlStateManager.enableAlpha();
    GlStateManager.popMatrix();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:21,代码来源:RenderPlasticMixer.java

示例2: getPickBlock

import net.minecraftforge.fluids.IFluidTank; //导入方法依赖的package包/类
@Override
@Nonnull
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
	ItemStack result = new ItemStack(this);
	TileEntityTank tile = getTileEntity(world, pos, TileEntityTank.class);
	if (tile != null) {
		IFluidTank tank = tile.getTank();
		if (tank.getFluidAmount() > 0) {
			NBTTagCompound tankTag = tile.getItemNBT();
			if (tankTag.hasKey("Amount")) tankTag.setInteger("Amount", tank.getCapacity());

			NBTTagCompound nbt = ItemUtils.getItemTag(result);
			nbt.setTag("tank", tankTag);
		}
	}
	return result;
}
 
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:18,代码来源:BlockTank.java

示例3: getRenderBounds

import net.minecraftforge.fluids.IFluidTank; //导入方法依赖的package包/类
static AxisAlignedBB getRenderBounds(IFluidTank tank, AxisAlignedBB tankBounds) {
    float percent = (float) tank.getFluidAmount() / (float) tank.getCapacity();

    double tankHeight = tankBounds.maxY - tankBounds.minY;
    double y1 = tankBounds.minY, y2 = (tankBounds.minY + (tankHeight * percent));
    if (tank.getFluid().getFluid().getDensity() < 0) {
        double yOff = tankBounds.maxY - y2;  // lighter than air fluids move to the top of the tank
        y1 += yOff; y2 += yOff;
    }
    return new AxisAlignedBB(tankBounds.minX, y1, tankBounds.minZ, tankBounds.maxX, y2, tankBounds.maxZ);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:12,代码来源:TankRenderHelper.java

示例4: actionPerformed

import net.minecraftforge.fluids.IFluidTank; //导入方法依赖的package包/类
@Override
public void actionPerformed(IGuiWidget widget) {
    super.actionPerformed(widget);
    if (widget instanceof WidgetFluidStack) {
        boolean leftClick = Mouse.isButtonDown(0);
        boolean middleClick = Mouse.isButtonDown(2);
        boolean shift = PneumaticCraftRepressurized.proxy.isSneakingInGui();
        IFluidTank tank = logistics.getTankFilter(widget.getID());
        if (tank.getFluidAmount() > 0) {
            if (middleClick) {
                logistics.setFilter(widget.getID(), null);
            } else if (leftClick) {
                tank.drain(shift ? tank.getFluidAmount() / 2 : 1000, true);
                if (tank.getFluidAmount() < 1000) {
                    tank.drain(1000, true);
                }
            } else {
                tank.fill(new FluidStack(tank.getFluid().getFluid(), shift ? tank.getFluidAmount() : 1000), true);
            }
            NetworkHandler.sendToServer(new PacketSetLogisticsFluidFilterStack(logistics, tank.getFluid(), widget.getID()));
        } else {
            fluidSearchGui = new GuiLogisticsLiquidFilter(this);
            editingSlot = widget.getID();
            mc.displayGuiScreen(fluidSearchGui);
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:28,代码来源:GuiLogisticsBase.java

示例5: actionPerformed

import net.minecraftforge.fluids.IFluidTank; //导入方法依赖的package包/类
@Override
public void actionPerformed(IGuiWidget widget){
    super.actionPerformed(widget);
    if(widget instanceof WidgetFluidStack) {
        boolean leftClick = Mouse.isButtonDown(0);
        boolean middleClick = Mouse.isButtonDown(2);
        boolean shift = PneumaticCraft.proxy.isSneakingInGui();
        IFluidTank tank = logistics.getTankFilter(widget.getID());
        if(tank.getFluidAmount() > 0) {
            if(middleClick) {
                logistics.setFilter(widget.getID(), (FluidStack)null);
            } else if(leftClick) {
                tank.drain(shift ? tank.getFluidAmount() / 2 : 1000, true);
                if(tank.getFluidAmount() < 1000) {
                    tank.drain(1000, true);
                }
            } else {
                tank.fill(new FluidStack(tank.getFluid().getFluid(), shift ? tank.getFluidAmount() : 1000), true);
            }
            NetworkHandler.sendToServer(new PacketSetLogisticsFluidFilterStack(logistics, tank.getFluid(), widget.getID()));
        } else {
            fluidSearchGui = new GuiLogisticsLiquidFilter(this);
            editingSlot = widget.getID();
            mc.displayGuiScreen(fluidSearchGui);
        }
    }
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:28,代码来源:GuiLogisticsBase.java

示例6: getPercentFull

import net.minecraftforge.fluids.IFluidTank; //导入方法依赖的package包/类
public float getPercentFull(IFluidTank tank) {
	return (((float) tank.getFluidAmount() / tank.getCapacity()));
}
 
开发者ID:TechStack,项目名称:TechStack-s-HeavyMachineryMod,代码行数:4,代码来源:TileEntityLiquidPipe.java


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