Search in sources :

Example 71 with FluidStack

use of net.minecraftforge.fluids.FluidStack in project Railcraft by Railcraft.

the class TileTankBase method syncClient.

@SuppressWarnings("ConstantConditions")
private void syncClient() {
    FluidStack fluidStack = tankManager.get(0).getFluid();
    if (!Fluids.areIdentical(previousFluidStack, fluidStack)) {
        previousFluidStack = fluidStack == null ? null : fluidStack.copy();
        sendUpdateToClient();
    }
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack)

Example 72 with FluidStack

use of net.minecraftforge.fluids.FluidStack in project Railcraft by Railcraft.

the class TileFluidUnloader method processCart.

@Override
protected void processCart(EntityMinecart cart) {
    AdvancedFluidHandler tankCart = getFluidHandler(cart, EnumFacing.DOWN);
    if (tankCart != null) {
        FluidStack moved = FluidUtil.tryFluidTransfer(tank, tankCart, RailcraftConfig.getTankCartFillRate(), true);
        setProcessing(Fluids.isNotEmpty(moved));
    }
}
Also used : AdvancedFluidHandler(mods.railcraft.common.fluids.AdvancedFluidHandler) FluidStack(net.minecraftforge.fluids.FluidStack)

Example 73 with FluidStack

use of net.minecraftforge.fluids.FluidStack in project Railcraft by Railcraft.

the class LiquidSlot method getTooltip.

@Override
public List<String> getTooltip(int x, int y, Object[] data, int dataIndex) {
    List<String> tooltip = null;
    if (data[dataIndex] instanceof FluidStack) {
        tooltip = new ArrayList<String>(1);
        FluidStack stack = (FluidStack) data[dataIndex];
        tooltip.add(stack.getFluid().getLocalizedName(stack) + " (" + stack.amount + " milliBuckets)");
    }
    return tooltip;
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack)

Example 74 with FluidStack

use of net.minecraftforge.fluids.FluidStack in project Railcraft by Railcraft.

the class LiquidSlot method draw.

@Override
public void draw(Renderer renderer, int recipeX, int recipeY, Object[] data, int dataIndex, boolean isMouseOver) {
    int x = recipeX + this.x;
    int y = recipeY + this.y;
    if (data[dataIndex] instanceof FluidStack) {
        FluidStack liquid = (FluidStack) data[dataIndex];
        TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
        Fluid fluid = liquid.getFluid();
        TextureAtlasSprite icon = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(fluid.getStill(liquid).toString());
        if (icon != null) {
            textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
            double u = icon.getInterpolatedU(3.0);
            double u2 = icon.getInterpolatedU(13.0);
            double v = icon.getInterpolatedV(1.0);
            double v2 = icon.getInterpolatedV(15.0);
            GL11.glEnable(GL11.GL_TEXTURE_2D);
            GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
            GL11.glBegin(GL11.GL_QUADS);
            GL11.glTexCoord2d(u, v);
            GL11.glVertex2i(x + 3, y + 1);
            GL11.glTexCoord2d(u, v2);
            GL11.glVertex2i(x + 3, y + 15);
            GL11.glTexCoord2d(u2, v2);
            GL11.glVertex2i(x + 13, y + 15);
            GL11.glTexCoord2d(u2, v);
            GL11.glVertex2i(x + 13, y + 1);
            GL11.glEnd();
        }
    }
    renderer.renderRect(x - 1, y - 1, 18, 18, containerTexture);
}
Also used : TextureManager(net.minecraft.client.renderer.texture.TextureManager) FluidStack(net.minecraftforge.fluids.FluidStack) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) Fluid(net.minecraftforge.fluids.Fluid)

Example 75 with FluidStack

use of net.minecraftforge.fluids.FluidStack in project Railcraft by Railcraft.

the class TankManager method setCapacity.

public void setCapacity(int tankIndex, int capacity) {
    StandardTank tank = get(tankIndex);
    tank.setCapacity(capacity);
    FluidStack fluidStack = tank.getFluid();
    if (fluidStack != null && fluidStack.amount > capacity)
        fluidStack.amount = capacity;
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack) StandardTank(mods.railcraft.common.fluids.tanks.StandardTank)

Aggregations

FluidStack (net.minecraftforge.fluids.FluidStack)188 ItemStack (net.minecraft.item.ItemStack)63 TileEntity (net.minecraft.tileentity.TileEntity)30 Fluid (net.minecraftforge.fluids.Fluid)28 IFluidHandler (net.minecraftforge.fluids.IFluidHandler)25 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)19 ArrayList (java.util.ArrayList)18 IFluidHandler (net.minecraftforge.fluids.capability.IFluidHandler)16 Block (net.minecraft.block.Block)12 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)12 FluidTankInfo (net.minecraftforge.fluids.FluidTankInfo)10 Item (net.minecraft.item.Item)9 BlockPos (net.minecraft.util.math.BlockPos)9 HashMap (java.util.HashMap)6 FluidIdentifier (logisticspipes.utils.FluidIdentifier)6 StandardTank (mods.railcraft.common.fluids.tanks.StandardTank)6 EntityPlayer (net.minecraft.entity.player.EntityPlayer)6 PipeFluidTransportLogistics (logisticspipes.transport.PipeFluidTransportLogistics)5 IBlockState (net.minecraft.block.state.IBlockState)5 EnumFacing (net.minecraft.util.EnumFacing)5