use of forestry.core.network.packets.PacketTankLevelUpdate in project ForestryMC by ForestryMC.
the class TankManager method updateTankLevels.
private void updateTankLevels(StandardTank tank, boolean sendUpdate) {
if (!(tile instanceof IRenderableTile)) {
return;
}
int tankIndex = tank.getTankIndex();
EnumTankLevel tankLevel = EnumTankLevel.rateTankLevel(tank);
if (tankLevel != tankLevels.get(tankIndex)) {
tankLevels.set(tankIndex, tankLevel);
if (sendUpdate) {
PacketTankLevelUpdate tankLevelUpdate = new PacketTankLevelUpdate(tile, tankIndex, tank.getFluid());
NetworkUtil.sendNetworkPacket(tankLevelUpdate, tile.getCoordinates(), tile.getWorldObj());
}
}
}
use of forestry.core.network.packets.PacketTankLevelUpdate in project ForestryMC by ForestryMC.
the class TankManager method sendTankUpdate.
private void sendTankUpdate(Container container, Iterable<IContainerListener> crafters, StandardTank tank) {
if (tile != null) {
int tankIndex = tank.getTankIndex();
FluidStack fluid = tank.getFluid();
IForestryPacketClient packet = new PacketTankLevelUpdate(tile, tankIndex, fluid);
for (IContainerListener crafter : crafters) {
if (crafter instanceof EntityPlayerMP) {
NetworkUtil.sendToPlayer(packet, (EntityPlayerMP) crafter);
}
}
if (fluid == null) {
prevFluidStacks.remove(container, tankIndex);
} else {
prevFluidStacks.put(container, tankIndex, fluid.copy());
}
}
}
Aggregations