Search in sources :

Example 1 with ServerboundGuideOpenRequestPacket

use of com.almuradev.almura.feature.guide.network.ServerboundGuideOpenRequestPacket in project Almura by AlmuraDev.

the class ClientboundPageChangeResponsePacketHandler method handleMessage.

@SideOnly(Side.CLIENT)
@Override
public void handleMessage(ClientboundPageChangeResponsePacket message, RemoteConnection connection, Platform.Type side) {
    if (side.isClient() && message.success) {
        final Minecraft client = Minecraft.getMinecraft();
        if (PacketUtil.checkThreadAndEnqueue(client, message, this, connection, side)) {
            final GuiScreen currentScreen = Minecraft.getMinecraft().currentScreen;
            if (currentScreen != null && currentScreen instanceof SimplePageView) {
                if (message.changeType == PageChangeType.REMOVE) {
                    ((SimplePageView) currentScreen).close();
                    manager.network.sendToServer(new ServerboundGuideOpenRequestPacket());
                } else {
                    ((SimplePageView) currentScreen).refreshPage();
                }
            }
        }
    }
}
Also used : GuiScreen(net.minecraft.client.gui.GuiScreen) Minecraft(net.minecraft.client.Minecraft) SimplePageView(com.almuradev.almura.feature.guide.client.gui.SimplePageView) ServerboundGuideOpenRequestPacket(com.almuradev.almura.feature.guide.network.ServerboundGuideOpenRequestPacket) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

SimplePageView (com.almuradev.almura.feature.guide.client.gui.SimplePageView)1 ServerboundGuideOpenRequestPacket (com.almuradev.almura.feature.guide.network.ServerboundGuideOpenRequestPacket)1 Minecraft (net.minecraft.client.Minecraft)1 GuiScreen (net.minecraft.client.gui.GuiScreen)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1