Search in sources :

Example 1 with PacketUIClientAction

use of gregtech.api.net.PacketUIClientAction in project GregTech by GregTechCE.

the class ModularUIContainer method writeClientAction.

@Override
public void writeClientAction(Widget widget, int updateId, Consumer<PacketBuffer> payloadWriter) {
    int widgetId = modularUI.guiWidgets.inverse().get(widget);
    PacketBuffer packetBuffer = new PacketBuffer(Unpooled.buffer());
    packetBuffer.writeVarInt(updateId);
    payloadWriter.accept(packetBuffer);
    if (modularUI.entityPlayer instanceof EntityPlayerSP) {
        PacketUIClientAction widgetUpdate = new PacketUIClientAction(windowId, widgetId, packetBuffer);
        NetworkHandler.channel.sendToServer(NetworkHandler.packet2proxy(widgetUpdate));
    }
}
Also used : PacketUIClientAction(gregtech.api.net.PacketUIClientAction) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) PacketBuffer(net.minecraft.network.PacketBuffer)

Aggregations

PacketUIClientAction (gregtech.api.net.PacketUIClientAction)1 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)1 PacketBuffer (net.minecraft.network.PacketBuffer)1