use of com.mraof.minestuck.item.ItemCaptchaCard 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