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);
}
}
}
Aggregations