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