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;
}