Examples of StandardTank


Examples of mods.railcraft.common.fluids.tanks.StandardTank

    }

    public void readPacketData(DataInputStream data, int tankIndex) throws IOException {
        if (tankIndex >= tanks.size())
            return;
        StandardTank tank = tanks.get(tankIndex);
        int fluidId = data.readShort();
        if (fluidId != -1) {
            tank.setFluid(new FluidStack(fluidId, data.readInt()));
            tank.colorCache = data.readInt();
        } else
            tank.setFluid(null);
    }
View Full Code Here

Examples of mods.railcraft.common.fluids.tanks.StandardTank

        player.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA + 0, fluidId);
        PacketBuilder.instance().sendGuiIntegerPacket((EntityPlayerMP) player, container.windowId, tankIndex * NETWORK_DATA + 1, fluidAmount);
    }

    public void updateGuiData(Container container, List crafters, int tankIndex) {
        StandardTank tank = tanks.get(tankIndex);
        FluidStack fluidStack = tank.getFluid();
        FluidStack prev = prevFluidStacks.get(tankIndex);
        int color = tank.getColor();
        int pColor = prevColor.get(tankIndex);

        for (Object crafter1 : crafters) {
            ICrafting crafter = (ICrafting) crafter1;
            EntityPlayerMP player = (EntityPlayerMP) crafter1;
            if (fluidStack == null ^ prev == null) {
                int fluidId = -1;
                int fluidAmount = 0;
                if (fluidStack != null) {
                    fluidId = fluidStack.fluidID;
                    fluidAmount = fluidStack.amount;
                }
                crafter.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA + 0, fluidId);
                PacketBuilder.instance().sendGuiIntegerPacket(player, container.windowId, tankIndex * NETWORK_DATA + 1, fluidAmount);
            } else if (fluidStack != null && prev != null) {
                if (fluidStack.getFluid() != prev.getFluid())
                    crafter.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA + 0, fluidStack.fluidID);
                if (fluidStack.amount != prev.amount)
                    PacketBuilder.instance().sendGuiIntegerPacket(player, container.windowId, tankIndex * NETWORK_DATA + 1, fluidStack.amount);
                if (color != pColor)
                    PacketBuilder.instance().sendGuiIntegerPacket(player, container.windowId, tankIndex * NETWORK_DATA + 2, color);
            }
        }

        prevFluidStacks.set(tankIndex, tank.getFluid() == null ? null : tank.getFluid().copy());
        prevColor.set(tankIndex, color);
    }
View Full Code Here

Examples of mods.railcraft.common.fluids.tanks.StandardTank

    public void processGuiUpdate(int messageId, int data) {
        int tankIndex = messageId / NETWORK_DATA;

        if (tankIndex >= tanks.size())
            return;
        StandardTank tank = tanks.get(tankIndex);
        FluidStack fluidStack = tank.getFluid();
        if (fluidStack == null) {
            fluidStack = new FluidStack(-1, 0);
            tank.setFluid(fluidStack);
        }
        int fluidId = fluidStack.fluidID;
        int amount = fluidStack.amount;
        int color = tank.colorCache;
        boolean newLiquid = false;
        switch (messageId % NETWORK_DATA) {
            case 0:
                fluidId = data;
                newLiquid = true;
                break;
            case 1:
                amount = data;
                break;
            case 2:
                color = data;
                break;
        }
        if (newLiquid) {
            fluidStack = new FluidStack(fluidId, 0);
            tank.setFluid(fluidStack);
        }
        fluidStack.amount = amount;
        tank.colorCache = color;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.