@@ -0,0 +1,1995 @@
+package info.u_team.u_team_core.intern.network;%0A%0Aimport java.util.*;%0Aimport java.util.function.Supplier;%0A%0Aimport info.u_team.u_team_core.container.*;%0Aimport net.minecraft.client.Minecraft;%0Aimport net.minecraft.inventory.container.Container;%0Aimport net.minecraft.network.PacketBuffer;%0Aimport net.minecraft.util.NonNullList;%0Aimport net.minecraftforge.fluids.FluidStack;%0Aimport net.minecraftforge.fml.network.NetworkEvent.Context;%0A%0Apublic class FluidSetAllContainerMessage %7B%0A%09%0A%09private final int id;%0A%09private List%3CFluidStack%3E stacks;%0A%09%0A%09public FluidSetAllContainerMessage(int id, List%3CFluidStack%3E stacks) %7B%0A%09%09this.id = id;%0A%09%09this.stacks = stacks;%0A%09%7D%0A%09%0A%09public static void encode(FluidSetAllContainerMessage message, PacketBuffer sendBuffer) %7B%0A%09%09sendBuffer.writeByte(message.id);%0A%09%09sendBuffer.writeShort(message.stacks.size());%0A%09%09for (FluidStack stack : message.stacks) %7B%0A%09%09%09sendBuffer.writeFluidStack(stack);%0A%09%09%7D%0A%09%7D%0A%09%0A%09public static FluidSetAllContainerMessage decode(PacketBuffer sendBuffer) %7B%0A%09%09final int id = sendBuffer.readByte();%0A%09%09final int size = sendBuffer.readShort();%0A%09%09final List%3CFluidStack%3E stacks = NonNullList.withSize(size, FluidStack.EMPTY);%0A%09%09for (int index = 0; index %3C size; index++) %7B%0A%09%09%09stacks.set(index, sendBuffer.readFluidStack());%0A%09%09%7D%0A%09%09return new FluidSetAllContainerMessage(id, stacks);%0A%09%7D%0A%09%0A%09public static class Handler %7B%0A%09%09%0A%09%09public static void handle(FluidSetAllContainerMessage message, Supplier%3CContext%3E contextSupplier) %7B%0A%09%09%09final Context context = contextSupplier.get();%0A%09%09%09context.enqueueWork(() -%3E %7B%0A%09%09%09%09getFluidContainer(Minecraft.getInstance().player.openContainer, message.id).ifPresent(container -%3E container.setAllFluidSlots(message.stacks));%0A%09%09%09%7D);%0A%09%09%09context.setPacketHandled(true);%0A%09%09%7D%0A%09%09%0A%09%09private static final Optional%3CFluidContainer%3E getFluidContainer(Container container, int id) %7B%0A%09%09%09if (container instanceof FluidContainer && container.windowId == id) %7B%0A%09%09%09%09return Optional.of((FluidContainer) container);%0A%09%09%09%7D%0A%09%09%09return Optional.empty();%0A%09%09%7D%0A%09%7D%0A%7D%0A

Add packet to sync all slots at container open