i++;
}
if(selectedState != null && (info != null && !info.nextState.identifier.equalsIgnoreCase(selectedState.identifier) || info == null && !selectedState.playerMorph.equalsIgnoreCase(mc.thePlayer.getCommandSenderName())))
{
PacketHandler.sendToServer(Morph.channels, new PacketGuiInput(0, selectedState.identifier, false));
}
}
else if(Morph.proxy.tickHandlerClient.radialShow)
{
Morph.proxy.tickHandlerClient.selectRadialMenu();
Morph.proxy.tickHandlerClient.radialShow = false;
}
}
else if(event.keyBind.equals(Morph.config.getKeyBind("keySelectorCancel")) || (event.keyBind.keyIndex == mc.gameSettings.keyBindUseItem.getKeyCode() && event.keyBind.isMinecraftBind()))
{
if(Morph.proxy.tickHandlerClient.selectorShow)
{
if(mc.currentScreen instanceof GuiIngameMenu)
{
mc.displayGuiScreen(null);
}
Morph.proxy.tickHandlerClient.selectorShow = false;
Morph.proxy.tickHandlerClient.selectorTimer = Morph.proxy.tickHandlerClient.selectorShowTime - Morph.proxy.tickHandlerClient.selectorTimer;
Morph.proxy.tickHandlerClient.scrollTimerHori = Morph.proxy.tickHandlerClient.scrollTime;
}
if(Morph.proxy.tickHandlerClient.radialShow)
{
Morph.proxy.tickHandlerClient.radialShow = false;
}
}
else if(event.keyBind.equals(Morph.config.getKeyBind("keySelectorRemoveMorph")) || event.keyBind.keyIndex == Keyboard.KEY_DELETE)
{
if(Morph.proxy.tickHandlerClient.selectorShow)
{
MorphInfoClient info = Morph.proxy.tickHandlerClient.playerMorphInfo.get(Minecraft.getMinecraft().thePlayer.getCommandSenderName());
MorphState selectedState = null;
int i = 0;
Iterator<Entry<String, ArrayList<MorphState>>> ite = Morph.proxy.tickHandlerClient.playerMorphCatMap.entrySet().iterator();
boolean multiple = false;
boolean decrease = false;
while(ite.hasNext())
{
Entry<String, ArrayList<MorphState>> e = ite.next();
if(i == Morph.proxy.tickHandlerClient.selectorSelected)
{
ArrayList<MorphState> states = e.getValue();
for(int j = 0; j < states.size(); j++)
{
if(j == Morph.proxy.tickHandlerClient.selectorSelectedHori)
{
selectedState = states.get(j);
if(j == states.size() - 1)
{
decrease = true;
}
break;
}
}
if(states.size() > 1)
{
multiple = true;
}
break;
}
i++;
}
if(selectedState != null && !selectedState.isFavourite && ((info == null || info != null && !info.nextState.identifier.equalsIgnoreCase(selectedState.identifier)) && !selectedState.playerMorph.equalsIgnoreCase(mc.thePlayer.getCommandSenderName())))
{
PacketHandler.sendToServer(Morph.channels, new PacketGuiInput(1, selectedState.identifier, false));
if(!multiple)
{
Morph.proxy.tickHandlerClient.selectorSelected--;
if(Morph.proxy.tickHandlerClient.selectorSelected < 0)
{
Morph.proxy.tickHandlerClient.selectorSelected = Morph.proxy.tickHandlerClient.playerMorphCatMap.size() - 1;
}
}
else if(decrease)
{
Morph.proxy.tickHandlerClient.selectorSelectedHori--;
if(Morph.proxy.tickHandlerClient.selectorSelected < 0)
{
Morph.proxy.tickHandlerClient.selectorSelected = 0;
}
}
}
}
}
else if(event.keyBind.equals(Morph.config.getKeyBind("keyFavourite")))
{
if(Morph.proxy.tickHandlerClient.selectorShow)
{
MorphState selectedState = null;
int i = 0;
Iterator<Entry<String, ArrayList<MorphState>>> ite = Morph.proxy.tickHandlerClient.playerMorphCatMap.entrySet().iterator();
while(ite.hasNext())
{
Entry<String, ArrayList<MorphState>> e = ite.next();
if(i == Morph.proxy.tickHandlerClient.selectorSelected)
{
ArrayList<MorphState> states = e.getValue();
for(int j = 0; j < states.size(); j++)
{
if(j == Morph.proxy.tickHandlerClient.selectorSelectedHori)
{
selectedState = states.get(j);
break;
}
}
break;
}
i++;
}
if(selectedState != null && !selectedState.playerMorph.equalsIgnoreCase(selectedState.playerName))
{
selectedState.isFavourite = !selectedState.isFavourite;
PacketHandler.sendToServer(Morph.channels, new PacketGuiInput(2, selectedState.identifier, selectedState.isFavourite));
}
}
else if(mc.currentScreen == null)
{
Morph.proxy.tickHandlerClient.favouriteStates.clear();