Search in sources :

Example 1 with ItemDriveForm

use of uk.co.wehavecookies56.kk.common.item.base.ItemDriveForm in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class InputHandler method loadLists.

public void loadLists() {
    Minecraft mc = Minecraft.getMinecraft();
    EntityPlayer player = mc.player;
    PlayerStatsCapability.IPlayerStats STATS = player.getCapability(ModCapabilities.PLAYER_STATS, null);
    IDriveState DS = player.getCapability(ModCapabilities.DRIVE_STATE, null);
    this.magicCommands = new ArrayList<String>();
    this.itemsCommands = new ArrayList<String>();
    this.driveCommands = new ArrayList<String>();
    this.portalCommands = new ArrayList<PortalCoords>();
    this.magicCommands.clear();
    for (int i = 0; i < player.getCapability(ModCapabilities.MAGIC_STATE, null).getInventorySpells().getSlots(); i++) if (!ItemStack.areItemStacksEqual(Minecraft.getMinecraft().player.getCapability(ModCapabilities.MAGIC_STATE, null).getInventorySpells().getStackInSlot(i), ItemStack.EMPTY))
        this.magicCommands.add(((ItemSpellOrb) Minecraft.getMinecraft().player.getCapability(ModCapabilities.MAGIC_STATE, null).getInventorySpells().getStackInSlot(i).getItem()).getMagicName());
    this.itemsCommands.clear();
    for (int i = 0; i < player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu().getSlots(); i++) if (!ItemStack.areItemStacksEqual(Minecraft.getMinecraft().player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu().getStackInSlot(i), ItemStack.EMPTY))
        this.itemsCommands.add(((ItemKKPotion) Minecraft.getMinecraft().player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu().getStackInSlot(i).getItem()).getUnlocalizedName().substring(5));
    this.driveCommands.clear();
    for (int i = 0; i < player.getCapability(ModCapabilities.DRIVE_STATE, null).getInventoryDriveForms().getSlots(); i++) if (!ItemStack.areItemStacksEqual(Minecraft.getMinecraft().player.getCapability(ModCapabilities.DRIVE_STATE, null).getInventoryDriveForms().getStackInSlot(i), ItemStack.EMPTY))
        this.driveCommands.add(((ItemDriveForm) Minecraft.getMinecraft().player.getCapability(ModCapabilities.DRIVE_STATE, null).getInventoryDriveForms().getStackInSlot(i).getItem()).getDriveFormName());
    this.portalCommands.clear();
    for (byte i = 0; i < 3; i++) {
        PortalCoords coords = player.getCapability(ModCapabilities.ORGANIZATION_XIII, null).getPortalCoords(i);
        if (!(coords.getX() == 0 && coords.getY() == 0 && coords.getZ() == 0)) {
            this.portalCommands.add(coords);
            System.out.println(i + " Added portal: " + coords.getPID());
        }
    }
}
Also used : PortalCoords(uk.co.wehavecookies56.kk.common.util.PortalCoords) ItemKKPotion(uk.co.wehavecookies56.kk.common.item.base.ItemKKPotion) PlayerStatsCapability(uk.co.wehavecookies56.kk.common.capability.PlayerStatsCapability) EntityPlayer(net.minecraft.entity.player.EntityPlayer) TextComponentString(net.minecraft.util.text.TextComponentString) Minecraft(net.minecraft.client.Minecraft) IDriveState(uk.co.wehavecookies56.kk.common.capability.DriveStateCapability.IDriveState)

Example 2 with ItemDriveForm

use of uk.co.wehavecookies56.kk.common.item.base.ItemDriveForm in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class LevelUpDrive method process.

@Override
public void process(EntityPlayer player, Side side) {
    int hasDriveInSlot = -1, nullSlot = -1;
    if (levels == 7) {
        player.getCapability(ModCapabilities.DRIVE_STATE, null).setDriveGaugeLevel(player.getCapability(ModCapabilities.DRIVE_STATE, null).getDriveGaugeLevel() + 1);
        player.getCapability(ModCapabilities.DRIVE_STATE, null).setDP(player.getCapability(ModCapabilities.DRIVE_STATE, null).getMaxDP());
        PacketDispatcher.sendTo(new SyncDriveData(player.getCapability(ModCapabilities.DRIVE_STATE, null)), (EntityPlayerMP) player);
        TextComponentTranslation driMessage = new TextComponentTranslation(Strings.Chat_DriveBoost, new TextComponentTranslation("" + player.getCapability(ModCapabilities.DRIVE_STATE, null).getDriveGaugeLevel()));
        driMessage.getStyle().setColor(TextFormatting.GREEN);
        player.sendMessage(driMessage);
    }
    PacketDispatcher.sendTo(new SyncDriveData(player.getCapability(ModCapabilities.DRIVE_STATE, null)), (EntityPlayerMP) player);
    player.getCapability(ModCapabilities.DRIVE_STATE, null).setDriveLevel(form, levels);
    for (int i = 0; i < InventoryDriveForms.INV_SIZE; i++) {
        if (!ItemStack.areItemStacksEqual(player.getCapability(ModCapabilities.DRIVE_STATE, null).getInventoryDriveForms().getStackInSlot(i), ItemStack.EMPTY)) {
            if (ItemStack.areItemStacksEqual(player.getCapability(ModCapabilities.DRIVE_STATE, null).getInventoryDriveForms().getStackInSlot(i), player.getHeldItem(EnumHand.MAIN_HAND))) {
                hasDriveInSlot = i;
            }
        } else {
            nullSlot = i;
            break;
        }
    }
    if (hasDriveInSlot == -1) {
        player.getCapability(ModCapabilities.DRIVE_STATE, null).getInventoryDriveForms().setStackInSlot(nullSlot, player.getHeldItem(EnumHand.MAIN_HAND));
        System.out.println(player.getHeldItemMainhand());
        if (player.getHeldItemMainhand().getItem() instanceof ItemDriveForm) {
            String form = ((ItemDriveForm) player.getHeldItemMainhand().getItem()).getDriveFormName();
            // System.out.println(form+"\n"+player.getCapability(ModCapabilities.DRIVE_STATE, null).getDriveLevel(form));
            if (player.getCapability(ModCapabilities.DRIVE_STATE, null).getDriveLevel(form) == 0) {
                player.getCapability(ModCapabilities.DRIVE_STATE, null).setDriveLevel(form, 1);
            }
        }
        player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
        TextComponentTranslation learnMessage = new TextComponentTranslation(Strings.Chat_Drive_Learn, new TextComponentTranslation(this.form));
        learnMessage.getStyle().setColor(TextFormatting.YELLOW);
        player.sendMessage(learnMessage);
    } else {
        TextComponentTranslation errorMessage = new TextComponentTranslation(Strings.Chat_Drive_Error, new TextComponentTranslation(this.form));
        errorMessage.getStyle().setColor(TextFormatting.YELLOW);
        player.sendMessage(errorMessage);
    }
    PacketDispatcher.sendTo(new SyncDriveInventory(player.getCapability(ModCapabilities.DRIVE_STATE, null)), (EntityPlayerMP) player);
    PacketDispatcher.sendTo(new SyncDriveData(player.getCapability(ModCapabilities.DRIVE_STATE, null)), (EntityPlayerMP) player);
}
Also used : SyncDriveData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncDriveData) TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) ItemDriveForm(uk.co.wehavecookies56.kk.common.item.base.ItemDriveForm) SyncDriveInventory(uk.co.wehavecookies56.kk.common.network.packet.client.SyncDriveInventory)

Example 3 with ItemDriveForm

use of uk.co.wehavecookies56.kk.common.item.base.ItemDriveForm in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class GuiCommandMenu method drawCommandMenu.

public void drawCommandMenu(int width, int height) {
    int extraY = 0;
    if (Minecraft.getMinecraft().player.getCapability(ModCapabilities.ORGANIZATION_XIII, null).getMember() != Utils.OrgMember.NONE) {
        extraY = 45;
    }
    int alpha = MainConfig.client.hud.guiAlpha;
    EntityPlayer player = Minecraft.getMinecraft().player;
    IDriveState DS = mc.player.getCapability(ModCapabilities.DRIVE_STATE, null);
    PlayerStatsCapability.IPlayerStats STATS = mc.player.getCapability(ModCapabilities.PLAYER_STATS, null);
    this.spells = new ArrayList<String>();
    this.items = new ArrayList<String>();
    this.driveCommands = new ArrayList<String>();
    this.portalCommands = new ArrayList<PortalCoords>();
    this.spells.clear();
    for (int i = 0; i < player.getCapability(ModCapabilities.MAGIC_STATE, null).getInventorySpells().getSlots(); i++) if (!ItemStack.areItemStacksEqual(Minecraft.getMinecraft().player.getCapability(ModCapabilities.MAGIC_STATE, null).getInventorySpells().getStackInSlot(i), ItemStack.EMPTY))
        this.spells.add(((ItemSpellOrb) Minecraft.getMinecraft().player.getCapability(ModCapabilities.MAGIC_STATE, null).getInventorySpells().getStackInSlot(i).getItem()).getMagicName());
    this.items.clear();
    for (int i = 0; i < player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu().getSlots(); i++) if (!ItemStack.areItemStacksEqual(Minecraft.getMinecraft().player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu().getStackInSlot(i), ItemStack.EMPTY))
        this.items.add(((ItemKKPotion) Minecraft.getMinecraft().player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu().getStackInSlot(i).getItem()).getUnlocalizedName().substring(5));
    this.driveCommands.clear();
    for (int i = 0; i < player.getCapability(ModCapabilities.DRIVE_STATE, null).getInventoryDriveForms().getSlots(); i++) if (!ItemStack.areItemStacksEqual(Minecraft.getMinecraft().player.getCapability(ModCapabilities.DRIVE_STATE, null).getInventoryDriveForms().getStackInSlot(i), ItemStack.EMPTY))
        this.driveCommands.add(((ItemDriveForm) Minecraft.getMinecraft().player.getCapability(ModCapabilities.DRIVE_STATE, null).getInventoryDriveForms().getStackInSlot(i).getItem()).getDriveFormName());
    this.portalCommands.clear();
    for (byte i = 0; i < 3; i++) {
        PortalCoords coords = player.getCapability(ModCapabilities.ORGANIZATION_XIII, null).getPortalCoords(i);
        // System.out.println(i+" "+coords);
        if (coords != null) {
            if (!(coords.getX() == 0 && coords.getY() == 0 && coords.getZ() == 0)) {
                this.portalCommands.add(coords);
            }
        }
    }
    float scale = 1.05f;
    int colour;
    // DRIVE
    GL11.glPushMatrix();
    {
        GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
        int u;
        int v = 0;
        int x = 0;
        mc.renderEngine.bindTexture(texture);
        GL11.glTranslatef(x, (height - MENU_HEIGHT * scale * DRIVE), 0);
        GL11.glScalef(scale, scale, scale);
        if (submenu != 0)
            GL11.glColor4ub((byte) 80, (byte) 80, (byte) 80, (byte) alpha);
        if (selected == DRIVE) {
            // Selected
            textX = 5;
            if (EntityEvents.isHostiles)
                drawTexturedModalRect(5, 0, TOP_WIDTH, 30 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
            else
                drawTexturedModalRect(5, 0, TOP_WIDTH, MENU_HEIGHT + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
        } else {
            // Not selected
            textX = 0;
            if (EntityEvents.isHostiles)
                drawTexturedModalRect(0, 0, 0, 30, TOP_WIDTH, v + MENU_HEIGHT);
            else
                drawTexturedModalRect(0, 0, TOP_WIDTH, 0 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
        }
        if (this.submenu == 0) {
            if (DS.getInDrive()) {
                if (DS.getActiveDriveName().equals(Strings.Form_Anti))
                    drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Drive_Revert), 6 + textX, 4, 0x888888);
                else
                    drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Drive_Revert), 6 + textX, 4, 0xFFFFFF);
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            } else if (this.driveCommands.isEmpty() || DS.getDP() <= 0) {
                if (extraY == 45)
                    // 0xFFFFFF
                    drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Limit), 6 + textX, 4, 0x888888);
                else
                    drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Drive), 6 + textX, 4, 0x888888);
            } else {
                if (extraY == 45)
                    // 0xFFFFFF
                    drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Limit), 6 + textX, 4, 0x888888);
                else
                    drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Drive), 6 + textX, 4, 0xFFFFFF);
            }
        }
    }
    GL11.glPopMatrix();
    // ITEMS
    GL11.glPushMatrix();
    {
        GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
        int u;
        int v = 0;
        int x = 0;
        mc.renderEngine.bindTexture(texture);
        GL11.glTranslatef(x, (height - MENU_HEIGHT * scale * ITEMS), 0);
        GL11.glScalef(scale, scale, scale);
        if (submenu != 0)
            GL11.glColor4ub((byte) 80, (byte) 80, (byte) 80, (byte) alpha);
        if (selected == ITEMS) {
            // Selected
            textX = 5;
            if (EntityEvents.isHostiles)
                drawTexturedModalRect(5, 0, TOP_WIDTH, 30 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
            else
                drawTexturedModalRect(5, 0, TOP_WIDTH, MENU_HEIGHT + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
        } else {
            // Not selected
            textX = 0;
            if (EntityEvents.isHostiles)
                drawTexturedModalRect(0, 0, 0, 30, TOP_WIDTH, v + MENU_HEIGHT);
            else
                drawTexturedModalRect(0, 0, TOP_WIDTH, 0 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
        }
        if (this.submenu == 0) {
            if (this.items.isEmpty())
                drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Items), 6 + textX, 4, 0x888888);
            else
                drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Items), 6 + textX, 4, 0xFFFFFF);
        }
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    }
    GL11.glPopMatrix();
    // MAGIC
    GL11.glPushMatrix();
    {
        GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
        int u;
        int v = 0;
        int x = 0;
        mc.renderEngine.bindTexture(texture);
        GL11.glTranslatef(x, (height - MENU_HEIGHT * scale * MAGIC), 0);
        GL11.glScalef(scale, scale, scale);
        if (submenu != 0)
            GL11.glColor4ub((byte) 80, (byte) 80, (byte) 80, (byte) alpha);
        if (selected == MAGIC) {
            // Selected
            textX = 5;
            if (EntityEvents.isHostiles)
                drawTexturedModalRect(5, 0, TOP_WIDTH, 30 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
            else
                drawTexturedModalRect(5, 0, TOP_WIDTH, MENU_HEIGHT + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
        } else {
            // Not selected
            textX = 0;
            if (EntityEvents.isHostiles)
                drawTexturedModalRect(0, 0, 0, 30, TOP_WIDTH, v + MENU_HEIGHT);
            else
                drawTexturedModalRect(0, 0, TOP_WIDTH, 0 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
        }
        if (this.submenu == 0) {
            int color;
            if (spells == null) {
                color = 0x888888;
            } else {
                if (!STATS.getRecharge() && (!this.spells.isEmpty() && !DS.getActiveDriveName().equals(Strings.Form_Valor)))
                    color = 0xFFFFFF;
                else
                    color = 0x888888;
            }
            drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Magic), 6 + textX, 4, color);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        }
    }
    GL11.glPopMatrix();
    // ATTACK
    GL11.glPushMatrix();
    {
        GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
        int u;
        int v = 0;
        int x = 0;
        mc.renderEngine.bindTexture(texture);
        GL11.glTranslatef(x, (height - MENU_HEIGHT * scale * ATTACK), 0);
        GL11.glScalef(scale, scale, scale);
        if (submenu != 0)
            GL11.glColor4ub((byte) 80, (byte) 80, (byte) 80, (byte) alpha);
        if (selected == ATTACK) {
            // Selected
            textX = 5;
            if (EntityEvents.isHostiles)
                drawTexturedModalRect(5, 0, TOP_WIDTH, 30 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
            else
                drawTexturedModalRect(5, 0, TOP_WIDTH, MENU_HEIGHT + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
        } else {
            // Not selected
            textX = 0;
            if (EntityEvents.isHostiles)
                drawTexturedModalRect(0, 0, 0, 30, TOP_WIDTH, v + MENU_HEIGHT);
            else
                drawTexturedModalRect(0, 0, TOP_WIDTH, 0 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
        }
        if (this.submenu == 0) {
            int color = this.portalCommands.isEmpty() || STATS.getRecharge() ? 0x888888 : 0xFFFFFF;
            if (extraY == 45)
                drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Portal), 6 + textX, 4, color);
            else
                drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Attack), 6 + textX, 4, color);
        }
    }
    GL11.glPopMatrix();
    // TOP
    GL11.glPushMatrix();
    {
        GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
        mc.renderEngine.bindTexture(texture);
        GL11.glTranslatef(0, (height - MENU_HEIGHT * scale * TOP), 0);
        GL11.glScalef(scale, scale, scale);
        if (submenu != 0)
            GL11.glColor4ub((byte) 80, (byte) 80, (byte) 80, (byte) alpha);
        if (EntityEvents.isHostiles)
            drawTexturedModalRect(0, 0, 0, 15, TOP_WIDTH, TOP_HEIGHT);
        else
            drawTexturedModalRect(0, 0, 0, 0 + extraY, TOP_WIDTH, TOP_HEIGHT);
        if (this.submenu == 0) {
            drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Command), 6, 4, 0xFFFFFF);
        }
    }
    GL11.glPopMatrix();
    // Portal submenu //
    if (portalCommands == null) {
    } else if (!portalCommands.isEmpty()) {
        // PORTAL TOP
        GL11.glPushMatrix();
        {
            GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
            mc.renderEngine.bindTexture(texture);
            GL11.glTranslatef(5, (height - MENU_HEIGHT * scale * (portalCommands.size() + 1)), 0);
            GL11.glScalef(scale, scale, scale);
            if (submenu == SUB_PORTALS) {
                drawTexturedModalRect(0, 0, 0, 0 + extraY, TOP_WIDTH, TOP_HEIGHT);
                drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Portals_Title), 6, 4, 0xFFFFFF);
            }
        }
        GL11.glPopMatrix();
        for (int i = 0; i < portalCommands.size(); i++) {
            GL11.glPushMatrix();
            {
                GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
                int u;
                int v;
                int x;
                x = (portalSelected == i) ? 10 : 5;
                mc.renderEngine.bindTexture(texture);
                GL11.glTranslatef(x, (height - MENU_HEIGHT * scale * (portalCommands.size() - i)), 0);
                GL11.glScalef(scale, scale, scale);
                if (submenu == SUB_PORTALS) {
                    v = 0;
                    if (portalSelected == i)
                        drawTexturedModalRect(0, 0, TOP_WIDTH, 15 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
                    else
                        drawTexturedModalRect(0, 0, TOP_WIDTH, 0 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
                    // colour = Constants.getCost(spells.get(i)) < STATS.getMP() ? 0xFFFFFF : 0xFF9900;
                    PortalCoords portal = portalCommands.get(i);
                    // String magicName = Constants.getMagicName(magic, level);
                    drawString(mc.fontRenderer, Utils.translateToLocal(portal.getShortCoords() + ""), 6, 4, 0xFFFFFF);
                    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                }
            }
            GL11.glPopMatrix();
        }
    }
    // Magic submenu //
    if (spells == null) {
    } else if (!spells.isEmpty()) {
        // MAGIC TOP
        GL11.glPushMatrix();
        {
            GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
            mc.renderEngine.bindTexture(texture);
            GL11.glTranslatef(5, (height - MENU_HEIGHT * scale * (spells.size() + 1)), 0);
            GL11.glScalef(scale, scale, scale);
            if (submenu == SUB_MAGIC) {
                drawTexturedModalRect(0, 0, 0, 0 + extraY, TOP_WIDTH, TOP_HEIGHT);
                drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Magic_Title), 6, 4, 0xFFFFFF);
            }
        }
        GL11.glPopMatrix();
        for (int i = 0; i < spells.size(); i++) {
            GL11.glPushMatrix();
            {
                GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
                int u;
                int v;
                int x;
                x = (magicselected == i) ? 10 : 5;
                mc.renderEngine.bindTexture(texture);
                GL11.glTranslatef(x, (height - MENU_HEIGHT * scale * (spells.size() - i)), 0);
                GL11.glScalef(scale, scale, scale);
                if (submenu == SUB_MAGIC) {
                    v = 0;
                    if (magicselected == i)
                        drawTexturedModalRect(0, 0, TOP_WIDTH, 15 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
                    else
                        drawTexturedModalRect(0, 0, TOP_WIDTH, 0 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
                    colour = Constants.getCost(spells.get(i)) < STATS.getMP() ? 0xFFFFFF : 0xFF9900;
                    if (spells.get(i).equals(Strings.Spell_Cure))
                        colour = 0xFF9900;
                    colour = STATS.getMP() < 1 ? 0x888888 : colour;
                    String magic = spells.get(i);
                    int level = mc.player.getCapability(ModCapabilities.MAGIC_STATE, null).getMagicLevel(magic);
                    String magicName = Constants.getMagicName(magic, level);
                    drawString(mc.fontRenderer, Utils.translateToLocal(magicName), 6, 4, colour);
                    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                }
            }
            GL11.glPopMatrix();
        }
    }
    // Items submenu //
    if (items == null) {
    } else if (!items.isEmpty()) {
        // Items TOP
        GL11.glPushMatrix();
        {
            GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
            mc.renderEngine.bindTexture(texture);
            GL11.glTranslatef(5, (height - MENU_HEIGHT * scale * (items.size() + 1)), 0);
            GL11.glScalef(scale, scale, scale);
            if (submenu == SUB_ITEMS) {
                drawTexturedModalRect(0, 0, 0, 0 + extraY, TOP_WIDTH, TOP_HEIGHT);
                drawString(mc.fontRenderer, Utils.translateToLocal("ITEMS"), 6, 4, 0xFFFFFF);
            }
        }
        GL11.glPopMatrix();
        for (int i = 0; i < items.size(); i++) {
            GL11.glPushMatrix();
            {
                GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
                int u;
                int v;
                int x;
                x = (potionselected == i) ? 10 : 5;
                mc.renderEngine.bindTexture(texture);
                GL11.glTranslatef(x, (height - MENU_HEIGHT * scale * (items.size() - i)), 0);
                GL11.glScalef(scale, scale, scale);
                if (submenu == SUB_ITEMS) {
                    v = 0;
                    if (potionselected == i)
                        drawTexturedModalRect(0, 0, TOP_WIDTH, 15 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
                    else
                        drawTexturedModalRect(0, 0, TOP_WIDTH, 0 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
                    drawString(mc.fontRenderer, Utils.translateToLocal("item." + items.get(i) + ".name"), 6, 4, 0xFFFFFF);
                    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                }
            }
            GL11.glPopMatrix();
        }
    }
    // Drive form submenu //
    if (driveCommands == null) {
    } else if (!driveCommands.isEmpty()) {
        // DRIVE TOP
        GL11.glPushMatrix();
        {
            GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
            mc.renderEngine.bindTexture(texture);
            GL11.glTranslatef(5, (height - MENU_HEIGHT * scale * (driveCommands.size() + 1)), 0);
            GL11.glScalef(1.25f, scale, scale);
            if (submenu == SUB_DRIVE)
                drawTexturedModalRect(0, 0, 0, 0 + extraY, TOP_WIDTH, TOP_HEIGHT);
        }
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        {
            GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
            GL11.glTranslatef(5, (height - MENU_HEIGHT * scale * (driveCommands.size() + 1)), 0);
            GL11.glScalef(scale, scale, scale);
            if (submenu == SUB_DRIVE)
                drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Drive_Title), 6, 4, 0xFFFFFF);
        }
        GL11.glPopMatrix();
        for (int i = 0; i < driveCommands.size(); i++) {
            GL11.glPushMatrix();
            {
                GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
                int u;
                int v;
                int x;
                x = (driveselected == i) ? 10 : 5;
                v = (driveselected == i) ? MENU_HEIGHT : 0;
                mc.renderEngine.bindTexture(texture);
                GL11.glTranslatef(x, (height - MENU_HEIGHT * scale * (driveCommands.size() - i)), 0);
                GL11.glScalef(1.25f, scale, scale);
                if (submenu == SUB_DRIVE) {
                    v = 0;
                    if (driveselected == i)
                        drawTexturedModalRect(0, 0, TOP_WIDTH, 15 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
                    else
                        drawTexturedModalRect(0, 0, TOP_WIDTH, 0 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
                }
            }
            GL11.glPopMatrix();
            GL11.glPushMatrix();
            {
                GL11.glColor4ub((byte) 80, (byte) 80, (byte) 80, (byte) alpha);
                int x;
                x = (driveselected == i) ? 10 : 5;
                GL11.glTranslatef(x, (height - MENU_HEIGHT * scale * (driveCommands.size() - i)), 0);
                GL11.glScalef(scale, scale, scale);
                if (submenu == SUB_DRIVE) {
                    if (DS.getDP() >= Constants.getCost(driveCommands.get(i)) || mc.player.getCapability(ModCapabilities.CHEAT_MODE, null).getCheatMode())
                        drawString(mc.fontRenderer, Utils.translateToLocal(driveCommands.get(i)), 6, 4, 0xFFFFFF);
                    else
                        drawString(mc.fontRenderer, Utils.translateToLocal(driveCommands.get(i)), 6, 4, 0x888888);
                }
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            }
            GL11.glPopMatrix();
        }
    }
}
Also used : PortalCoords(uk.co.wehavecookies56.kk.common.util.PortalCoords) ItemKKPotion(uk.co.wehavecookies56.kk.common.item.base.ItemKKPotion) PlayerStatsCapability(uk.co.wehavecookies56.kk.common.capability.PlayerStatsCapability) EntityPlayer(net.minecraft.entity.player.EntityPlayer) IDriveState(uk.co.wehavecookies56.kk.common.capability.DriveStateCapability.IDriveState)

Aggregations

EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 IDriveState (uk.co.wehavecookies56.kk.common.capability.DriveStateCapability.IDriveState)2 PlayerStatsCapability (uk.co.wehavecookies56.kk.common.capability.PlayerStatsCapability)2 ItemKKPotion (uk.co.wehavecookies56.kk.common.item.base.ItemKKPotion)2 PortalCoords (uk.co.wehavecookies56.kk.common.util.PortalCoords)2 Minecraft (net.minecraft.client.Minecraft)1 TextComponentString (net.minecraft.util.text.TextComponentString)1 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)1 ItemDriveForm (uk.co.wehavecookies56.kk.common.item.base.ItemDriveForm)1 SyncDriveData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncDriveData)1 SyncDriveInventory (uk.co.wehavecookies56.kk.common.network.packet.client.SyncDriveInventory)1