WIP - minor fixes
This commit is contained in:
parent
de48b8401c
commit
3d6354e808
3 changed files with 32 additions and 5 deletions
|
@ -268,6 +268,7 @@ public class BattleGui extends GuiScreen
|
||||||
break;
|
break;
|
||||||
case DECIDE_USE_ITEM:
|
case DECIDE_USE_ITEM:
|
||||||
setState(MenuState.USE_ITEM);
|
setState(MenuState.USE_ITEM);
|
||||||
|
break;
|
||||||
case CANCEL:
|
case CANCEL:
|
||||||
setState(MenuState.MAIN_MENU);
|
setState(MenuState.MAIN_MENU);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -795,6 +795,11 @@ public class Battle
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case USE_ITEM:
|
case USE_ITEM:
|
||||||
|
if(next.itemToUse < 0 || next.itemToUse > 8)
|
||||||
|
{
|
||||||
|
sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getEntityId(), 0, PacketBattleMessage.UsedItemAction.USED_INVALID.getValue());
|
||||||
|
break;
|
||||||
|
}
|
||||||
ItemStack targetItemStack = ((EntityPlayer)next.entity).inventory.getStackInSlot(next.itemToUse);
|
ItemStack targetItemStack = ((EntityPlayer)next.entity).inventory.getStackInSlot(next.itemToUse);
|
||||||
Item targetItem = targetItemStack.getItem();
|
Item targetItem = targetItemStack.getItem();
|
||||||
if(targetItem == null)
|
if(targetItem == null)
|
||||||
|
@ -819,10 +824,15 @@ public class Battle
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SWITCH_ITEM:
|
case SWITCH_ITEM:
|
||||||
((EntityPlayer)next.entity).inventory.currentItem = next.itemToUse;
|
if(next.itemToUse < 0 || next.itemToUse > 8)
|
||||||
|
{
|
||||||
sendMessageToAllPlayers(PacketBattleMessage.MessageType.SWITCHED_ITEM, next.entity.getEntityId(), 0, 0);
|
sendMessageToAllPlayers(PacketBattleMessage.MessageType.SWITCHED_ITEM, next.entity.getEntityId(), 0, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
((EntityPlayer)next.entity).inventory.currentItem = next.itemToUse;
|
||||||
|
sendMessageToAllPlayers(PacketBattleMessage.MessageType.SWITCHED_ITEM, next.entity.getEntityId(), 0, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
next = turnOrderQueue.poll();
|
next = turnOrderQueue.poll();
|
||||||
}
|
}
|
||||||
for(Combatant c : sideA.values())
|
for(Combatant c : sideA.values())
|
||||||
|
|
|
@ -297,8 +297,16 @@ public class PacketBattleMessage implements IMessage
|
||||||
from + " tried to use nothing!"));
|
from + " tried to use nothing!"));
|
||||||
break;
|
break;
|
||||||
case USED_INVALID:
|
case USED_INVALID:
|
||||||
|
if(message.custom.length() > 0)
|
||||||
|
{
|
||||||
Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new TextComponentString(
|
Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new TextComponentString(
|
||||||
from + " tried to consume " + message.custom + " and failed!"));
|
from + " tried to consume " + message.custom + " and failed!"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new TextComponentString(
|
||||||
|
from + " tried to consume an invalid item and failed!"));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case USED_FOOD:
|
case USED_FOOD:
|
||||||
Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new TextComponentString(
|
Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new TextComponentString(
|
||||||
|
@ -327,8 +335,16 @@ public class PacketBattleMessage implements IMessage
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SWITCHED_ITEM:
|
case SWITCHED_ITEM:
|
||||||
|
if(message.amount != 0)
|
||||||
|
{
|
||||||
Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new TextComponentString(
|
Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new TextComponentString(
|
||||||
to + " switched to a different item!"));
|
to + " switched to a different item!"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new TextComponentString(
|
||||||
|
to + " switched to a different item but failed because it was invalid!"));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in a new issue