Search in sources :

Example 1 with MagicWisdomShot

use of uk.co.wehavecookies56.kk.common.network.packet.server.magics.MagicWisdomShot in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class InputHandler method commandEnter.

public void commandEnter() {
    Minecraft mc = Minecraft.getMinecraft();
    EntityPlayer player = mc.player;
    World world = mc.world;
    PlayerStatsCapability.IPlayerStats STATS = player.getCapability(ModCapabilities.PLAYER_STATS, null);
    IDriveState DRIVE = player.getCapability(ModCapabilities.DRIVE_STATE, null);
    loadLists();
    switch(GuiCommandMenu.selected) {
        case GuiCommandMenu.ATTACK:
            player.swingArm(EnumHand.MAIN_HAND);
            if (player.getCapability(ModCapabilities.ORGANIZATION_XIII, null).getMember() != Utils.OrgMember.NONE) {
                // Submenu of the portals
                if (GuiCommandMenu.submenu == GuiCommandMenu.SUB_MAIN) {
                    if (!this.portalCommands.isEmpty() && !STATS.getRecharge()) {
                        GuiCommandMenu.submenu = GuiCommandMenu.SUB_PORTALS;
                        GuiCommandMenu.portalSelected = 0;
                        world.playSound(player, player.getPosition(), ModSounds.select, SoundCategory.MASTER, 1.0f, 1.0f);
                    } else {
                        GuiCommandMenu.selected = GuiCommandMenu.ATTACK;
                        world.playSound(player, player.getPosition(), ModSounds.error, SoundCategory.MASTER, 1.0f, 1.0f);
                    }
                    return;
                }
            }
            if (player.getCapability(ModCapabilities.DRIVE_STATE, null).getActiveDriveName().equals(Strings.Form_Wisdom)) {
                PacketDispatcher.sendToServer(new MagicWisdomShot());
            }
            break;
        case GuiCommandMenu.MAGIC:
            if (GuiCommandMenu.submenu == GuiCommandMenu.SUB_MAIN) {
                if (!STATS.getRecharge() && (!this.magicCommands.isEmpty() && !DRIVE.getActiveDriveName().equals(Strings.Form_Valor))) {
                    GuiCommandMenu.magicselected = 0;
                    GuiCommandMenu.submenu = GuiCommandMenu.SUB_MAGIC;
                    world.playSound(player, player.getPosition(), ModSounds.select, SoundCategory.MASTER, 1.0f, 1.0f);
                    return;
                } else {
                    GuiCommandMenu.selected = GuiCommandMenu.ATTACK;
                    world.playSound(player, player.getPosition(), ModSounds.error, SoundCategory.MASTER, 1.0f, 1.0f);
                }
            }
            break;
        case GuiCommandMenu.ITEMS:
            if (GuiCommandMenu.submenu == GuiCommandMenu.SUB_MAIN) {
                if (!this.itemsCommands.isEmpty()) {
                    GuiCommandMenu.submenu = GuiCommandMenu.SUB_ITEMS;
                    GuiCommandMenu.potionselected = 0;
                    world.playSound(player, player.getPosition(), ModSounds.select, SoundCategory.MASTER, 1.0f, 1.0f);
                } else {
                    GuiCommandMenu.selected = GuiCommandMenu.ATTACK;
                    world.playSound(player, player.getPosition(), ModSounds.error, SoundCategory.MASTER, 1.0f, 1.0f);
                }
                return;
            }
            break;
        case GuiCommandMenu.DRIVE:
            if (GuiCommandMenu.submenu == GuiCommandMenu.SUB_MAIN) {
                if (player.getCapability(ModCapabilities.ORGANIZATION_XIII, null).getMember() != Utils.OrgMember.NONE) {
                    // TODO Use Limit
                    player.sendMessage(new TextComponentString("Limits are not available yet"));
                    GuiCommandMenu.submenu = GuiCommandMenu.SUB_MAIN;
                    GuiCommandMenu.selected = GuiCommandMenu.ATTACK;
                    world.playSound(player, player.getPosition(), ModSounds.error, SoundCategory.MASTER, 1.0f, 1.0f);
                } else {
                    if (DRIVE.getInDrive()) {
                        // Revert
                        if (DRIVE.getActiveDriveName().equals(Strings.Form_Anti) && !player.getCapability(ModCapabilities.CHEAT_MODE, null).getCheatMode()) {
                            GuiCommandMenu.selected = GuiCommandMenu.ATTACK;
                            world.playSound(player, player.getPosition(), ModSounds.error, SoundCategory.MASTER, 1.0f, 1.0f);
                            player.sendMessage(new TextComponentTranslation("Cannot revert while in Anti form"));
                        } else {
                            PacketDispatcher.sendToServer(new DriveFormPacket(DRIVE.getActiveDriveName(), true));
                            if (DriveFormRegistry.isDriveFormRegistered(DRIVE.getActiveDriveName()))
                                DriveFormRegistry.get(DRIVE.getActiveDriveName()).endDrive(player);
                            GuiCommandMenu.submenu = GuiCommandMenu.SUB_MAIN;
                            GuiCommandMenu.selected = GuiCommandMenu.ATTACK;
                            world.playSound(player, player.getPosition(), ModSounds.select, SoundCategory.MASTER, 1.0f, 1.0f);
                        }
                    } else if (this.driveCommands.isEmpty() || DRIVE.getDP() <= 0) {
                        world.playSound(player, player.getPosition(), ModSounds.error, SoundCategory.MASTER, 1.0f, 1.0f);
                        GuiCommandMenu.selected = GuiCommandMenu.ATTACK;
                    } else {
                        GuiCommandMenu.driveselected = 0;
                        GuiCommandMenu.submenu = GuiCommandMenu.SUB_DRIVE;
                        world.playSound(player, player.getPosition(), ModSounds.select, SoundCategory.MASTER, 1.0f, 1.0f);
                        return;
                    }
                }
            }
            break;
    }
    // Portal Submenu
    if (GuiCommandMenu.selected == GuiCommandMenu.ATTACK && GuiCommandMenu.submenu == GuiCommandMenu.SUB_PORTALS) {
        if (this.portalCommands.isEmpty()) {
        } else {
            // ModDriveForms.getDriveForm(player, world, (String) this.driveCommands.get(GuiCommandMenu.driveselected));
            if (!player.getCapability(ModCapabilities.PLAYER_STATS, null).getRecharge()) {
                PortalCoords coords = this.portalCommands.get((byte) GuiCommandMenu.portalSelected);
                if (coords.getX() != 0 && coords.getY() != 0 && coords.getZ() != 0) {
                    // ValidPortal
                    summonPortal(player, coords);
                } else {
                    player.sendMessage(new TextComponentString(TextFormatting.RED + "You don't have any portal destination"));
                }
                GuiCommandMenu.selected = GuiCommandMenu.ATTACK;
                GuiCommandMenu.submenu = GuiCommandMenu.SUB_MAIN;
                world.playSound(player, player.getPosition(), ModSounds.select, SoundCategory.MASTER, 1.0f, 1.0f);
            }
        }
    }
    // Magic Submenu
    if (GuiCommandMenu.selected == GuiCommandMenu.MAGIC && GuiCommandMenu.submenu == GuiCommandMenu.SUB_MAGIC) {
        if (this.magicCommands.isEmpty()) {
        } else if (!STATS.getRecharge() || Constants.getCost((String) this.magicCommands.get(GuiCommandMenu.magicselected)) == -1 && STATS.getMP() > 0) {
            Magic.getMagic(player, world, (String) this.magicCommands.get(GuiCommandMenu.magicselected));
            GuiCommandMenu.selected = GuiCommandMenu.ATTACK;
            GuiCommandMenu.submenu = GuiCommandMenu.SUB_MAIN;
            world.playSound(player, player.getPosition(), ModSounds.select, SoundCategory.MASTER, 1.0f, 1.0f);
        }
    }
    if (GuiCommandMenu.selected == GuiCommandMenu.ITEMS && GuiCommandMenu.submenu == GuiCommandMenu.SUB_ITEMS) {
        if (this.itemsCommands.isEmpty()) {
        } else if (!this.itemsCommands.isEmpty()) {
            ItemKKPotion.getItem(player, world, (String) this.itemsCommands.get(GuiCommandMenu.potionselected), GuiCommandMenu.potionselected);
            GuiCommandMenu.selected = GuiCommandMenu.ATTACK;
            GuiCommandMenu.submenu = GuiCommandMenu.SUB_MAIN;
            world.playSound(player, player.getPosition(), ModSounds.select, SoundCategory.MASTER, 1.0f, 1.0f);
        }
    }
    if (GuiCommandMenu.selected == GuiCommandMenu.DRIVE && GuiCommandMenu.submenu == GuiCommandMenu.SUB_DRIVE) {
        if (this.driveCommands.isEmpty()) {
        } else if ((DRIVE.getDP() >= Constants.getCost((String) this.driveCommands.get(GuiCommandMenu.driveselected)))) {
            if (this.driveCommands.get(GuiCommandMenu.driveselected).equals(Strings.Form_Final)) {
                ModDriveForms.getDriveForm(player, world, (String) this.driveCommands.get(GuiCommandMenu.driveselected));
            } else {
                if (!antiFormCheck()) {
                    ModDriveForms.getDriveForm(player, world, (String) this.driveCommands.get(GuiCommandMenu.driveselected));
                }
            }
            GuiCommandMenu.selected = GuiCommandMenu.ATTACK;
            GuiCommandMenu.submenu = GuiCommandMenu.SUB_MAIN;
            world.playSound(player, player.getPosition(), ModSounds.select, SoundCategory.MASTER, 1.0f, 1.0f);
        }
    }
}
Also used : PortalCoords(uk.co.wehavecookies56.kk.common.util.PortalCoords) TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) MagicWisdomShot(uk.co.wehavecookies56.kk.common.network.packet.server.magics.MagicWisdomShot) PlayerStatsCapability(uk.co.wehavecookies56.kk.common.capability.PlayerStatsCapability) EntityPlayer(net.minecraft.entity.player.EntityPlayer) DriveFormPacket(uk.co.wehavecookies56.kk.common.network.packet.server.DriveFormPacket) TextComponentString(net.minecraft.util.text.TextComponentString) World(net.minecraft.world.World) Minecraft(net.minecraft.client.Minecraft) IDriveState(uk.co.wehavecookies56.kk.common.capability.DriveStateCapability.IDriveState) TextComponentString(net.minecraft.util.text.TextComponentString)

Aggregations

Minecraft (net.minecraft.client.Minecraft)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 TextComponentString (net.minecraft.util.text.TextComponentString)1 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)1 World (net.minecraft.world.World)1 IDriveState (uk.co.wehavecookies56.kk.common.capability.DriveStateCapability.IDriveState)1 PlayerStatsCapability (uk.co.wehavecookies56.kk.common.capability.PlayerStatsCapability)1 DriveFormPacket (uk.co.wehavecookies56.kk.common.network.packet.server.DriveFormPacket)1 MagicWisdomShot (uk.co.wehavecookies56.kk.common.network.packet.server.magics.MagicWisdomShot)1 PortalCoords (uk.co.wehavecookies56.kk.common.util.PortalCoords)1