Search in sources :

Example 1 with GuiPositionedContainer

use of micdoodle8.mods.galacticraft.core.client.gui.container.GuiPositionedContainer in project Galacticraft by micdoodle8.

the class EventHandlerGC method schematicFlipEvent.

@SideOnly(Side.CLIENT)
@SubscribeEvent
public void schematicFlipEvent(FlipPage event) {
    ISchematicPage page = null;
    switch(event.direction) {
        case 1:
            page = EventHandlerGC.getNextSchematic(event.index);
            break;
        case -1:
            page = EventHandlerGC.getLastSchematic(event.index);
            break;
    }
    if (page != null) {
        GuiScreen cs = event.currentGui;
        int benchX = (int) FMLClientHandler.instance().getClient().thePlayer.posX;
        int benchY = (int) FMLClientHandler.instance().getClient().thePlayer.posY;
        int benchZ = (int) FMLClientHandler.instance().getClient().thePlayer.posZ;
        if (cs instanceof GuiPositionedContainer) {
            benchX = ((GuiPositionedContainer) cs).getX();
            benchY = ((GuiPositionedContainer) cs).getY();
            benchZ = ((GuiPositionedContainer) cs).getZ();
        }
        GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_OPEN_SCHEMATIC_PAGE, GCCoreUtil.getDimensionID(FMLClientHandler.instance().getClient().theWorld), new Object[] { page.getPageID(), benchX, benchY, benchZ }));
        FMLClientHandler.instance().getClient().thePlayer.openGui(GalacticraftCore.instance, page.getGuiID(), FMLClientHandler.instance().getClient().thePlayer.worldObj, benchX, benchY, benchZ);
    }
}
Also used : GuiPositionedContainer(micdoodle8.mods.galacticraft.core.client.gui.container.GuiPositionedContainer) PacketSimple(micdoodle8.mods.galacticraft.core.network.PacketSimple) GuiScreen(net.minecraft.client.gui.GuiScreen) ISchematicPage(micdoodle8.mods.galacticraft.api.recipe.ISchematicPage) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

ISchematicPage (micdoodle8.mods.galacticraft.api.recipe.ISchematicPage)1 GuiPositionedContainer (micdoodle8.mods.galacticraft.core.client.gui.container.GuiPositionedContainer)1 PacketSimple (micdoodle8.mods.galacticraft.core.network.PacketSimple)1 GuiScreen (net.minecraft.client.gui.GuiScreen)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1