Search in sources :

Example 1 with ItemKKPotion

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

the class ItemKKPotion method getItem.

public static void getItem(EntityPlayer player, World world, String item, int slot) {
    while (ItemStack.areItemStacksEqual(player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu().getStackInSlot(slot), ItemStack.EMPTY)) {
        slot++;
    }
    switch(item) {
        case Strings.Potion:
            ((ItemKKPotion) ModItems.Potion).getPotionEffect(player);
            player.world.playSound((EntityPlayer) null, player.getPosition(), ModSounds.potion, SoundCategory.MASTER, 1.0f, 1.0f);
            player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu().setStackInSlot(slot, ItemStack.EMPTY);
            PacketDispatcher.sendToServer(new PotionConsume(Strings.Potion));
            PacketDispatcher.sendToServer(new RemoveItemInSlot(Strings.Potion, slot, true));
            break;
        case Strings.HiPotion:
            ((ItemKKPotion) ModItems.HiPotion).getPotionEffect(player);
            player.world.playSound((EntityPlayer) null, player.getPosition(), ModSounds.potion, SoundCategory.MASTER, 1.0f, 1.0f);
            player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu().setStackInSlot(slot, ItemStack.EMPTY);
            PacketDispatcher.sendToServer(new PotionConsume(Strings.HiPotion));
            PacketDispatcher.sendToServer(new RemoveItemInSlot(Strings.Potion, slot, true));
            break;
        case Strings.MegaPotion:
            ((ItemKKPotion) ModItems.MegaPotion).getPotionEffect(player);
            player.world.playSound((EntityPlayer) null, player.getPosition(), ModSounds.potion, SoundCategory.MASTER, 1.0f, 1.0f);
            player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu().setStackInSlot(slot, ItemStack.EMPTY);
            PacketDispatcher.sendToServer(new PotionConsume(Strings.MegaPotion));
            PacketDispatcher.sendToServer(new RemoveItemInSlot(Strings.Potion, slot, true));
            break;
        case Strings.Ether:
            ((ItemKKPotion) ModItems.Ether).getPotionEffect(player);
            player.world.playSound((EntityPlayer) null, player.getPosition(), ModSounds.potion, SoundCategory.MASTER, 1.0f, 1.0f);
            player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu().setStackInSlot(slot, ItemStack.EMPTY);
            PacketDispatcher.sendToServer(new PotionConsume(Strings.Ether));
            PacketDispatcher.sendToServer(new RemoveItemInSlot(Strings.Potion, slot, true));
            break;
        case Strings.MegaEther:
            ((ItemKKPotion) ModItems.MegaEther).getPotionEffect(player);
            player.world.playSound((EntityPlayer) null, player.getPosition(), ModSounds.potion, SoundCategory.MASTER, 1.0f, 1.0f);
            player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu().setStackInSlot(slot, ItemStack.EMPTY);
            PacketDispatcher.sendToServer(new PotionConsume(Strings.MegaEther));
            PacketDispatcher.sendToServer(new RemoveItemInSlot(Strings.Potion, slot, true));
            break;
        case Strings.Elixir:
            ((ItemKKPotion) ModItems.Elixir).getPotionEffect(player);
            player.world.playSound((EntityPlayer) null, player.getPosition(), ModSounds.potion, SoundCategory.MASTER, 1.0f, 1.0f);
            player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu().setStackInSlot(slot, ItemStack.EMPTY);
            PacketDispatcher.sendToServer(new PotionConsume(Strings.Elixir));
            PacketDispatcher.sendToServer(new RemoveItemInSlot(Strings.Potion, slot, true));
            break;
        case Strings.Megalixir:
            ((ItemKKPotion) ModItems.Megalixir).getPotionEffect(player);
            player.world.playSound((EntityPlayer) null, player.getPosition(), ModSounds.potion, SoundCategory.MASTER, 1.0f, 1.0f);
            player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu().setStackInSlot(slot, ItemStack.EMPTY);
            PacketDispatcher.sendToServer(new PotionConsume(Strings.Megalixir));
            PacketDispatcher.sendToServer(new RemoveItemInSlot(Strings.Potion, slot, true));
            break;
        case Strings.DriveRecovery:
            ((ItemKKPotion) ModItems.DriveRecovery).getPotionEffect(player);
            player.world.playSound((EntityPlayer) null, player.getPosition(), ModSounds.potion, SoundCategory.MASTER, 1.0f, 1.0f);
            player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu().setStackInSlot(slot, ItemStack.EMPTY);
            PacketDispatcher.sendToServer(new PotionConsume(Strings.DriveRecovery));
            PacketDispatcher.sendToServer(new RemoveItemInSlot(Strings.Potion, slot, true));
            break;
        case Strings.HighDriveRecovery:
            ((ItemKKPotion) ModItems.HighDriveRecovery).getPotionEffect(player);
            player.world.playSound((EntityPlayer) null, player.getPosition(), ModSounds.potion, SoundCategory.MASTER, 1.0f, 1.0f);
            player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu().setStackInSlot(slot, ItemStack.EMPTY);
            PacketDispatcher.sendToServer(new PotionConsume(Strings.HighDriveRecovery));
            PacketDispatcher.sendToServer(new RemoveItemInSlot(Strings.Potion, slot, true));
            break;
        case Strings.Panacea:
            ((ItemKKPotion) ModItems.Panacaea).getPotionEffect(player);
            player.world.playSound((EntityPlayer) null, player.getPosition(), ModSounds.potion, SoundCategory.MASTER, 1.0f, 1.0f);
            player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu().setStackInSlot(slot, ItemStack.EMPTY);
            PacketDispatcher.sendToServer(new PotionConsume(Strings.Panacea));
            PacketDispatcher.sendToServer(new RemoveItemInSlot(Strings.Potion, slot, true));
            break;
        default:
            break;
    }
}
Also used : RemoveItemInSlot(uk.co.wehavecookies56.kk.common.network.packet.server.RemoveItemInSlot) PotionConsume(uk.co.wehavecookies56.kk.common.network.packet.server.PotionConsume)

Example 2 with ItemKKPotion

use of uk.co.wehavecookies56.kk.common.item.base.ItemKKPotion 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 3 with ItemKKPotion

use of uk.co.wehavecookies56.kk.common.item.base.ItemKKPotion 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 PotionConsume (uk.co.wehavecookies56.kk.common.network.packet.server.PotionConsume)1 RemoveItemInSlot (uk.co.wehavecookies56.kk.common.network.packet.server.RemoveItemInSlot)1