use of net.minecraft.network.play.client.CPacketCloseWindow in project Minestuck by mraof.
the class GuiPlayerStats method openGui.
public static void openGui(boolean reload) {
Minecraft mc = Minecraft.getMinecraft();
if (reload || mc.currentScreen == null) {
if (mc.currentScreen != null && mc.currentScreen instanceof GuiContainer) {
mc.player.connection.sendPacket(new CPacketCloseWindow(mc.player.openContainer.windowId));
mc.player.inventory.setItemStack(ItemStack.EMPTY);
}
if (ClientEditHandler.isActive() ? editmodeTab.isContainer : normalTab.isContainer) {
GuiPlayerStatsContainer guiContainer = (GuiPlayerStatsContainer) (ClientEditHandler.isActive() ? editmodeTab.createGuiInstance() : normalTab.createGuiInstance());
int ordinal = (ClientEditHandler.isActive() ? editmodeTab : normalTab).ordinal();
guiContainer.inventorySlots.windowId = ContainerHandler.clientWindowIdStart + ordinal;
MinestuckChannelHandler.sendToServer(MinestuckPacket.makePacket(Type.CONTAINER, ordinal));
mc.displayGuiScreen(guiContainer);
} else
mc.displayGuiScreen(ClientEditHandler.isActive() ? editmodeTab.createGuiInstance() : normalTab.createGuiInstance());
} else if (mc.currentScreen instanceof GuiPlayerStats || mc.currentScreen instanceof GuiPlayerStatsContainer)
mc.displayGuiScreen(null);
}
use of net.minecraft.network.play.client.CPacketCloseWindow in project Minestuck by mraof.
the class GuiCaptchaDeck method actionPerformed.
@Override
protected void actionPerformed(GuiButton button) {
if (button == this.modusButton && !container.inventory.getStackInSlot(0).isEmpty()) {
ItemStack stack = container.inventory.getStackInSlot(0);
if (!(stack.getItem() instanceof ItemCaptchaCard)) {
Modus newModus = CaptchaDeckHandler.createInstance(CaptchaDeckHandler.getType(stack), Side.CLIENT);
if (newModus != null && CaptchaDeckHandler.clientSideModus != null && newModus.getClass() != CaptchaDeckHandler.clientSideModus.getClass() && !newModus.canSwitchFrom(CaptchaDeckHandler.clientSideModus)) {
mc.currentScreen = new GuiYesNo(this, I18n.format("gui.emptySylladex1"), I18n.format("gui.emptySylladex2"), 0) {
@Override
public void onGuiClosed() {
mc.currentScreen = (GuiScreen) parentScreen;
mc.player.closeScreen();
}
};
mc.currentScreen.setWorldAndResolution(mc, width, height);
return;
}
}
MinestuckChannelHandler.sendToServer(MinestuckPacket.makePacket(Type.CAPTCHA, CaptchaDeckPacket.MODUS));
} else if (button == this.sylladexMap && CaptchaDeckHandler.clientSideModus != null) {
mc.player.connection.sendPacket(new CPacketCloseWindow(mc.player.openContainer.windowId));
mc.player.inventory.setItemStack(ItemStack.EMPTY);
mc.displayGuiScreen(CaptchaDeckHandler.clientSideModus.getGuiHandler());
mc.player.openContainer = mc.player.inventoryContainer;
}
}
Aggregations