2019-11-25 06:29:25 +00:00
|
|
|
package com.burnedkirby.TurnBasedMinecraft.client;
|
2018-09-12 06:39:55 +00:00
|
|
|
|
2019-11-25 06:29:25 +00:00
|
|
|
import com.burnedkirby.TurnBasedMinecraft.common.Battle;
|
|
|
|
import com.burnedkirby.TurnBasedMinecraft.common.CommonProxy;
|
2022-05-17 05:47:42 +00:00
|
|
|
import com.burnedkirby.TurnBasedMinecraft.common.EntityInfo;
|
|
|
|
import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod;
|
|
|
|
import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketBattleMessage;
|
|
|
|
import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketEditingMessage;
|
|
|
|
import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketGeneralMessage;
|
2018-09-12 06:39:55 +00:00
|
|
|
import net.minecraft.client.Minecraft;
|
2022-05-17 05:47:42 +00:00
|
|
|
import net.minecraft.client.Options;
|
|
|
|
import net.minecraft.network.chat.ClickEvent;
|
|
|
|
import net.minecraft.network.chat.HoverEvent;
|
|
|
|
import net.minecraft.network.chat.TextColor;
|
|
|
|
import net.minecraft.network.chat.TextComponent;
|
|
|
|
import net.minecraft.resources.ResourceKey;
|
|
|
|
import net.minecraft.sounds.SoundSource;
|
|
|
|
import net.minecraft.world.entity.Entity;
|
|
|
|
import net.minecraft.world.level.Level;
|
|
|
|
import net.minecraftforge.network.NetworkEvent;
|
2020-11-12 08:10:01 +00:00
|
|
|
|
|
|
|
import java.util.UUID;
|
2022-05-17 05:47:42 +00:00
|
|
|
import java.util.function.Supplier;
|
2018-09-12 06:39:55 +00:00
|
|
|
|
|
|
|
public class ClientProxy extends CommonProxy
|
|
|
|
{
|
2018-09-28 08:45:32 +00:00
|
|
|
private BattleGui battleGui = null;
|
|
|
|
private BattleMusic battleMusic = null;
|
|
|
|
private int battleMusicCount = 0;
|
|
|
|
private int sillyMusicCount = 0;
|
|
|
|
private Battle localBattle = null;
|
2018-09-12 06:39:55 +00:00
|
|
|
|
2018-09-20 06:15:34 +00:00
|
|
|
@Override
|
2018-10-04 03:07:26 +00:00
|
|
|
protected void initializeClient()
|
2018-09-12 06:39:55 +00:00
|
|
|
{
|
|
|
|
battleGui = new BattleGui();
|
2018-09-14 05:14:10 +00:00
|
|
|
battleMusic = null; // will be initialized in postInit()
|
2018-09-27 09:09:40 +00:00
|
|
|
battleMusicCount = 0;
|
|
|
|
sillyMusicCount = 0;
|
2018-09-28 03:13:07 +00:00
|
|
|
localBattle = null;
|
2019-11-29 09:52:28 +00:00
|
|
|
logger.debug("Init client");
|
2018-09-12 06:39:55 +00:00
|
|
|
}
|
2018-09-20 06:15:34 +00:00
|
|
|
|
2018-09-12 06:39:55 +00:00
|
|
|
@Override
|
|
|
|
public void setBattleGuiTime(int timeRemaining)
|
|
|
|
{
|
2018-09-28 08:45:32 +00:00
|
|
|
battleGui.setTimeRemaining(timeRemaining);
|
2018-09-12 06:39:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setBattleGuiBattleChanged()
|
|
|
|
{
|
|
|
|
battleGui.battleChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setBattleGuiAsGui()
|
|
|
|
{
|
2021-05-21 05:44:31 +00:00
|
|
|
if(Minecraft.getInstance().screen != battleGui)
|
2019-10-21 07:13:11 +00:00
|
|
|
{
|
|
|
|
battleGui.turnEnd();
|
2021-05-21 05:44:31 +00:00
|
|
|
Minecraft.getInstance().setScreen(battleGui);
|
2019-10-21 07:13:11 +00:00
|
|
|
}
|
2018-09-12 06:39:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void battleGuiTurnBegin()
|
|
|
|
{
|
|
|
|
battleGui.turnBegin();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void battleGuiTurnEnd()
|
|
|
|
{
|
|
|
|
battleGui.turnEnd();
|
|
|
|
}
|
2018-09-14 03:44:45 +00:00
|
|
|
|
2018-09-18 07:58:01 +00:00
|
|
|
@Override
|
|
|
|
public void battleStarted()
|
|
|
|
{
|
|
|
|
setBattleGuiAsGui();
|
|
|
|
}
|
|
|
|
|
2018-09-14 03:44:45 +00:00
|
|
|
@Override
|
|
|
|
public void battleEnded()
|
|
|
|
{
|
2018-09-28 03:13:07 +00:00
|
|
|
localBattle = null;
|
2021-05-21 05:44:31 +00:00
|
|
|
Minecraft.getInstance().setScreen(null);
|
2018-09-27 07:44:28 +00:00
|
|
|
stopMusic(true);
|
2018-09-27 09:09:40 +00:00
|
|
|
battleMusicCount = 0;
|
|
|
|
sillyMusicCount = 0;
|
2018-09-14 03:44:45 +00:00
|
|
|
}
|
2018-09-14 05:14:10 +00:00
|
|
|
|
|
|
|
@Override
|
2018-10-04 03:07:26 +00:00
|
|
|
protected void postInitClient()
|
2018-09-14 05:14:10 +00:00
|
|
|
{
|
2018-09-28 08:45:32 +00:00
|
|
|
battleMusic = new BattleMusic(getLogger());
|
2018-09-14 05:14:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void playBattleMusic()
|
|
|
|
{
|
2022-05-17 05:47:42 +00:00
|
|
|
Options gs = Minecraft.getInstance().options;
|
|
|
|
battleMusic.playBattle(gs.getSoundSourceVolume(SoundSource.MUSIC) * gs.getSoundSourceVolume(SoundSource.MASTER));
|
2018-09-14 05:14:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void playSillyMusic()
|
|
|
|
{
|
2022-05-17 05:47:42 +00:00
|
|
|
Options gs = Minecraft.getInstance().options;
|
|
|
|
battleMusic.playSilly(gs.getSoundSourceVolume(SoundSource.MUSIC) * gs.getSoundSourceVolume(SoundSource.MASTER));
|
2018-09-14 05:14:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-09-27 07:44:28 +00:00
|
|
|
public void stopMusic(boolean resumeMCSounds)
|
2018-09-14 05:14:10 +00:00
|
|
|
{
|
2018-09-27 07:44:28 +00:00
|
|
|
battleMusic.stopMusic(resumeMCSounds);
|
2018-09-14 05:14:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets what music to play based on type and loaded Config
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public void typeEnteredBattle(String type)
|
|
|
|
{
|
2021-05-23 06:38:04 +00:00
|
|
|
if(localBattle == null) {
|
2018-09-27 09:09:40 +00:00
|
|
|
return;
|
2021-05-23 06:38:04 +00:00
|
|
|
} if(type == null || type.isEmpty() || getConfig().isBattleMusicType(type)) {
|
2018-09-27 09:09:40 +00:00
|
|
|
++battleMusicCount;
|
2021-05-23 06:38:04 +00:00
|
|
|
} else if(getConfig().isSillyMusicType(type)) {
|
2018-09-27 09:09:40 +00:00
|
|
|
++sillyMusicCount;
|
2021-05-23 06:38:04 +00:00
|
|
|
} else {
|
2018-09-27 09:09:40 +00:00
|
|
|
++battleMusicCount;
|
2018-09-14 05:14:10 +00:00
|
|
|
}
|
2021-05-23 06:38:04 +00:00
|
|
|
checkBattleTypes(false);
|
2018-09-27 09:09:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void typeLeftBattle(String type)
|
|
|
|
{
|
2021-05-23 06:38:04 +00:00
|
|
|
if(localBattle == null || localBattle.getSideA().isEmpty() || localBattle.getSideB().isEmpty())
|
2018-09-27 09:09:40 +00:00
|
|
|
{
|
2021-05-23 06:38:04 +00:00
|
|
|
battleMusicCount = 0;
|
|
|
|
sillyMusicCount = 0;
|
2018-09-27 09:09:40 +00:00
|
|
|
return;
|
2021-05-23 06:38:04 +00:00
|
|
|
} else if(type == null || type.isEmpty() || getConfig().isBattleMusicType(type)) {
|
2018-09-27 09:09:40 +00:00
|
|
|
--battleMusicCount;
|
2021-05-23 06:38:04 +00:00
|
|
|
} else if(getConfig().isSillyMusicType(type)) {
|
2018-09-27 09:09:40 +00:00
|
|
|
--sillyMusicCount;
|
2021-05-23 06:38:04 +00:00
|
|
|
} else {
|
2018-09-27 09:09:40 +00:00
|
|
|
--battleMusicCount;
|
|
|
|
}
|
2021-05-23 06:38:04 +00:00
|
|
|
checkBattleTypes(true);
|
2018-09-14 05:14:10 +00:00
|
|
|
}
|
|
|
|
|
2018-09-17 04:27:13 +00:00
|
|
|
@Override
|
|
|
|
public void displayString(String message)
|
|
|
|
{
|
2022-05-17 05:47:42 +00:00
|
|
|
TextComponent prefix = new TextComponent("TBM: ");
|
|
|
|
prefix.withStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true));
|
|
|
|
TextComponent text = new TextComponent(message);
|
2020-11-12 08:10:01 +00:00
|
|
|
prefix.getSiblings().add(text);
|
2022-05-17 05:47:42 +00:00
|
|
|
text.withStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
2020-11-12 08:10:01 +00:00
|
|
|
// UUID is required by sendMessage, but appears to be unused, so just give dummy UUID
|
|
|
|
Minecraft.getInstance().player.sendMessage(prefix, UUID.randomUUID());
|
2018-09-17 04:27:13 +00:00
|
|
|
}
|
|
|
|
|
2018-10-24 08:20:04 +00:00
|
|
|
@Override
|
2022-05-17 05:47:42 +00:00
|
|
|
public void displayTextComponent(TextComponent text)
|
2018-10-24 08:20:04 +00:00
|
|
|
{
|
2020-11-12 08:10:01 +00:00
|
|
|
// UUID is required by sendMessage, but appears to be unused, so just give dummy UUID
|
|
|
|
Minecraft.getInstance().player.sendMessage(text, UUID.randomUUID());
|
2018-10-24 08:20:04 +00:00
|
|
|
}
|
|
|
|
|
2021-05-23 06:38:04 +00:00
|
|
|
private void checkBattleTypes(boolean entityLeft)
|
2018-09-27 09:09:40 +00:00
|
|
|
{
|
2021-05-23 06:38:04 +00:00
|
|
|
// check that battle is still valid
|
|
|
|
if(localBattle == null && entityLeft && (localBattle.getSideA().isEmpty() || localBattle.getSideB().isEmpty())) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
float percentage = 0.0f;
|
2018-09-28 03:02:39 +00:00
|
|
|
if(sillyMusicCount == 0 && battleMusicCount == 0)
|
|
|
|
{
|
|
|
|
percentage = 0.0f;
|
|
|
|
}
|
|
|
|
else if(battleMusicCount == 0)
|
|
|
|
{
|
|
|
|
percentage = 100.0f;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
percentage = 100.0f * (float)sillyMusicCount / (float)(sillyMusicCount + battleMusicCount);
|
|
|
|
}
|
|
|
|
|
2018-09-28 08:45:32 +00:00
|
|
|
if(percentage >= (float)getConfig().getSillyMusicThreshold())
|
2018-09-27 09:09:40 +00:00
|
|
|
{
|
|
|
|
if(battleMusic.isPlaying())
|
|
|
|
{
|
|
|
|
if(!battleMusic.isPlayingSilly() && battleMusic.hasSillyMusic())
|
|
|
|
{
|
|
|
|
stopMusic(false);
|
|
|
|
playSillyMusic();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(battleMusic.hasSillyMusic())
|
|
|
|
{
|
|
|
|
playSillyMusic();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(battleMusic.isPlaying())
|
|
|
|
{
|
|
|
|
if(battleMusic.isPlayingSilly() && battleMusic.hasBattleMusic())
|
|
|
|
{
|
|
|
|
stopMusic(false);
|
|
|
|
playBattleMusic();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(battleMusic.hasBattleMusic())
|
|
|
|
{
|
|
|
|
playBattleMusic();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-09-28 03:13:07 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public Battle getLocalBattle()
|
|
|
|
{
|
|
|
|
return localBattle;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void createLocalBattle(int id)
|
|
|
|
{
|
2021-05-21 05:44:31 +00:00
|
|
|
localBattle = new Battle(null, id, null, null, false, Minecraft.getInstance().level.dimension());
|
2018-09-28 03:13:07 +00:00
|
|
|
}
|
2019-11-29 09:52:28 +00:00
|
|
|
|
|
|
|
@Override
|
2022-05-17 05:47:42 +00:00
|
|
|
public Entity getEntity(int id, ResourceKey<Level> dim) {
|
2021-05-21 05:44:31 +00:00
|
|
|
return Minecraft.getInstance().level.getEntity(id);
|
2019-11-29 09:52:28 +00:00
|
|
|
}
|
2022-05-17 05:47:42 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public <MSG> void handlePacket(MSG msg, Supplier<NetworkEvent.Context> ctx) {
|
|
|
|
if (msg.getClass() == PacketBattleMessage.class) {
|
|
|
|
PacketBattleMessage pkt = (PacketBattleMessage)msg;
|
|
|
|
Entity fromEntity = getEntity(pkt.getEntityIDFrom(), pkt.getDimension());
|
|
|
|
String from = "Unknown";
|
|
|
|
if(fromEntity != null)
|
|
|
|
{
|
|
|
|
from = fromEntity.getDisplayName().getString();
|
|
|
|
}
|
|
|
|
else if(TurnBasedMinecraftMod.proxy.getLocalBattle() != null)
|
|
|
|
{
|
|
|
|
fromEntity = TurnBasedMinecraftMod.proxy.getLocalBattle().getCombatantEntity(pkt.getEntityIDFrom());
|
|
|
|
if(fromEntity != null)
|
|
|
|
{
|
|
|
|
from = fromEntity.getDisplayName().getString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Entity toEntity = TurnBasedMinecraftMod.proxy.getEntity(pkt.getEntityIDTo(), pkt.getDimension());
|
|
|
|
String to = "Unknown";
|
|
|
|
if(toEntity != null)
|
|
|
|
{
|
|
|
|
to = toEntity.getDisplayName().getString();
|
|
|
|
}
|
|
|
|
else if(TurnBasedMinecraftMod.proxy.getLocalBattle() != null)
|
|
|
|
{
|
|
|
|
toEntity = TurnBasedMinecraftMod.proxy.getLocalBattle().getCombatantEntity(pkt.getEntityIDTo());
|
|
|
|
if(toEntity != null)
|
|
|
|
{
|
|
|
|
to = toEntity.getDisplayName().getString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(pkt.getMessageType())
|
|
|
|
{
|
|
|
|
case ENTERED:
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(from + " entered battle!");
|
|
|
|
if(TurnBasedMinecraftMod.proxy.getLocalBattle() == null || TurnBasedMinecraftMod.proxy.getLocalBattle().getId() != pkt.getAmount())
|
|
|
|
{
|
|
|
|
TurnBasedMinecraftMod.proxy.createLocalBattle(pkt.getAmount());
|
|
|
|
}
|
|
|
|
TurnBasedMinecraftMod.proxy.battleStarted();
|
|
|
|
TurnBasedMinecraftMod.proxy.typeEnteredBattle(pkt.getCustom());
|
|
|
|
break;
|
|
|
|
case FLEE:
|
|
|
|
if(pkt.getAmount() != 0)
|
|
|
|
{
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(from + " fled battle!");
|
|
|
|
TurnBasedMinecraftMod.proxy.typeLeftBattle(pkt.getCustom());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(from + " tried to flee battle but failed!");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DIED:
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(from + " died in battle!");
|
|
|
|
TurnBasedMinecraftMod.proxy.typeLeftBattle(pkt.getCustom());
|
|
|
|
break;
|
|
|
|
case ENDED:
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString("Battle has ended!");
|
|
|
|
TurnBasedMinecraftMod.proxy.battleEnded();
|
|
|
|
break;
|
|
|
|
case ATTACK:
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(from + " attacked " + to + " and dealt " + pkt.getAmount() + " damage!");
|
|
|
|
break;
|
|
|
|
case DEFEND:
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(from + " blocked " + to + "'s attack!");
|
|
|
|
break;
|
|
|
|
case DEFENSE_DAMAGE:
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(from + " retaliated from " + to + "'s attack and dealt " + pkt.getAmount() + " damage!");
|
|
|
|
break;
|
|
|
|
case MISS:
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(from + " attacked " + to + " but missed!");
|
|
|
|
break;
|
|
|
|
case DEFENDING:
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(from + " is defending!");
|
|
|
|
break;
|
|
|
|
case DID_NOTHING:
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(from + " did nothing!");
|
|
|
|
break;
|
|
|
|
case USED_ITEM:
|
|
|
|
switch(PacketBattleMessage.UsedItemAction.valueOf(pkt.getAmount()))
|
|
|
|
{
|
|
|
|
case USED_NOTHING:
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(from + " tried to use nothing!");
|
|
|
|
break;
|
|
|
|
case USED_INVALID:
|
|
|
|
if(pkt.getCustom().length() > 0)
|
|
|
|
{
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(from + " tried to consume " + pkt.getCustom() + " and failed!");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(from + " tried to consume an invalid item and failed!");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case USED_FOOD:
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(from + " ate a " + pkt.getCustom() + "!");
|
|
|
|
break;
|
|
|
|
case USED_POTION:
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(from + " drank a " + pkt.getCustom() + "!");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TURN_BEGIN:
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString("The turn begins!");
|
|
|
|
TurnBasedMinecraftMod.proxy.battleGuiTurnBegin();
|
|
|
|
break;
|
|
|
|
case TURN_END:
|
|
|
|
if(TurnBasedMinecraftMod.proxy.getLocalBattle() != null)
|
|
|
|
{
|
|
|
|
if(pkt.getAmount() == 0)
|
|
|
|
{
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString("The turn ended!");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString("The turn ended (abnormally due to internal error)!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TurnBasedMinecraftMod.proxy.battleGuiTurnEnd();
|
|
|
|
break;
|
|
|
|
case SWITCHED_ITEM:
|
|
|
|
if(pkt.getAmount() != 0)
|
|
|
|
{
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(from + " switched to a different item!");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(from + " switched to a different item but failed because it was invalid!");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WAS_AFFECTED:
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(to + " was " + pkt.getCustom() + " by " + from + "!");
|
|
|
|
break;
|
|
|
|
case BECAME_CREATIVE:
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(from + " entered creative mode and left battle!");
|
|
|
|
break;
|
|
|
|
case FIRED_ARROW:
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(from + " let loose an arrow towards " + to + "!");
|
|
|
|
break;
|
|
|
|
case ARROW_HIT:
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(to + " was hit by " + from + "'s arrow!");
|
|
|
|
break;
|
|
|
|
case BOW_NO_AMMO:
|
|
|
|
TurnBasedMinecraftMod.proxy.displayString(from + " tried to use their bow but ran out of ammo!");
|
|
|
|
break;
|
|
|
|
case CREEPER_WAIT: {
|
|
|
|
TextComponent prefix = new TextComponent("TBM: ");
|
|
|
|
prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true));
|
|
|
|
TextComponent message = new TextComponent(from + " is charging up!");
|
|
|
|
message.setStyle(message.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)));
|
|
|
|
prefix.getSiblings().add(message);
|
|
|
|
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CREEPER_WAIT_FINAL: {
|
|
|
|
TextComponent prefix = new TextComponent("TBM: ");
|
|
|
|
prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true));
|
|
|
|
TextComponent message = new TextComponent(from + " is about to explode!");
|
|
|
|
message.setStyle(message.getStyle().withColor(TextColor.fromRgb(0xFFFF5050)));
|
|
|
|
prefix.getSiblings().add(message);
|
|
|
|
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CREEPER_EXPLODE: {
|
|
|
|
TextComponent prefix = new TextComponent("TBM: ");
|
|
|
|
prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true));
|
|
|
|
TextComponent message = new TextComponent(from + " exploded!");
|
|
|
|
message.setStyle(message.getStyle().withColor(TextColor.fromRgb(0xFFFF0000)));
|
|
|
|
prefix.getSiblings().add(message);
|
|
|
|
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else if (msg.getClass() == PacketGeneralMessage.class) {
|
|
|
|
PacketGeneralMessage pkt = (PacketGeneralMessage)msg;
|
|
|
|
displayString(pkt.getMessage());
|
|
|
|
} else if (msg.getClass() == PacketEditingMessage.class) {
|
|
|
|
PacketEditingMessage pkt = (PacketEditingMessage)msg;
|
|
|
|
switch(pkt.getType())
|
|
|
|
{
|
|
|
|
case ATTACK_ENTITY:
|
|
|
|
{
|
|
|
|
TextComponent prefix = new TextComponent("TBM: ");
|
|
|
|
prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true));
|
|
|
|
TextComponent text = new TextComponent("Attack the entity you want to edit for TurnBasedMinecraftMod. ");
|
|
|
|
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
|
|
|
|
|
|
|
TextComponent cancel = new TextComponent("Cancel");
|
|
|
|
cancel.setStyle(cancel.getStyle().withColor(TextColor.fromRgb(0xFFFF0000)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit cancel")));
|
|
|
|
text.getSiblings().add(cancel);
|
|
|
|
|
|
|
|
prefix.getSiblings().add(text);
|
|
|
|
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case PICK_EDIT:
|
|
|
|
{
|
|
|
|
TextComponent prefix = new TextComponent("TBM: ");
|
|
|
|
prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true));
|
|
|
|
TextComponent text = new TextComponent("Edit what value? ");
|
|
|
|
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
|
|
|
|
|
|
|
TextComponent option = new TextComponent("IgB");
|
|
|
|
// HoverEvent.Action.SHOW_TEXT is probably SHOW_TEXT
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle"))
|
|
|
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("IgnoreBattle"))));
|
|
|
|
TextComponent value = new TextComponent("(" + pkt.getEntityInfo().ignoreBattle + ") ");
|
|
|
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
option.getSiblings().add(value);
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
|
|
|
|
option = new TextComponent("AP");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackPower"))
|
|
|
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("AttackPower"))));
|
|
|
|
value = new TextComponent("(" + pkt.getEntityInfo().attackPower + ") ");
|
|
|
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
option.getSiblings().add(value);
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
|
|
|
|
option = new TextComponent("APr");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackProbability"))
|
|
|
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("AttackProbability"))));
|
|
|
|
value = new TextComponent("(" + pkt.getEntityInfo().attackProbability + "%) ");
|
|
|
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
option.getSiblings().add(value);
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
|
|
|
|
option = new TextComponent("AV");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackVariance"))
|
|
|
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("AttackVariance"))));
|
|
|
|
value = new TextComponent("(" + pkt.getEntityInfo().attackVariance + ") ");
|
|
|
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
option.getSiblings().add(value);
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
|
|
|
|
option = new TextComponent("AE");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffect"))
|
|
|
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("AttackEffect"))));
|
|
|
|
value = new TextComponent("(" + pkt.getEntityInfo().attackEffect.toString() + ") ");
|
|
|
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
option.getSiblings().add(value);
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
|
|
|
|
option = new TextComponent("AEPr");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffectProbability"))
|
|
|
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("AttackEffectProbability"))));
|
|
|
|
value = new TextComponent("(" + pkt.getEntityInfo().attackEffectProbability + "%) ");
|
|
|
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
option.getSiblings().add(value);
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
|
|
|
|
option = new TextComponent("DD");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamage"))
|
|
|
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("DefenseDamage"))));
|
|
|
|
value = new TextComponent("(" + pkt.getEntityInfo().defenseDamage + ") ");
|
|
|
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
option.getSiblings().add(value);
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
|
|
|
|
option = new TextComponent("DDPr");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamageProbability"))
|
|
|
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("DefenseDamageProbability"))));
|
|
|
|
value = new TextComponent("(" + pkt.getEntityInfo().defenseDamageProbability + "%) ");
|
|
|
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
option.getSiblings().add(value);
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
|
|
|
|
option = new TextComponent("E");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit evasion"))
|
|
|
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("Evasion"))));
|
|
|
|
value = new TextComponent("(" + pkt.getEntityInfo().evasion + "%) ");
|
|
|
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
option.getSiblings().add(value);
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
|
|
|
|
option = new TextComponent("S");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit speed"))
|
|
|
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("Speed"))));
|
|
|
|
value = new TextComponent("(" + pkt.getEntityInfo().speed + ") ");
|
|
|
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
option.getSiblings().add(value);
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
|
|
|
|
option = new TextComponent("C");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category"))
|
|
|
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("Category"))));
|
|
|
|
value = new TextComponent("(" + pkt.getEntityInfo().category + ") ");
|
|
|
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
option.getSiblings().add(value);
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
|
|
|
|
option = new TextComponent("DecA");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionAttack"))
|
|
|
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("DecisionAttack"))));
|
|
|
|
value = new TextComponent("(" + pkt.getEntityInfo().decisionAttack + "%) ");
|
|
|
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
option.getSiblings().add(value);
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
|
|
|
|
option = new TextComponent("DecD");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionDefend"))
|
|
|
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("DecisionDefend"))));
|
|
|
|
value = new TextComponent("(" + pkt.getEntityInfo().decisionDefend + "%) ");
|
|
|
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
option.getSiblings().add(value);
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
|
|
|
|
option = new TextComponent("DecF");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionFlee"))
|
|
|
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent("DecisionFlee"))));
|
|
|
|
value = new TextComponent("(" + pkt.getEntityInfo().decisionFlee + "%) ");
|
|
|
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
option.getSiblings().add(value);
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
|
|
|
|
option = new TextComponent("Finished Editing");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit finish")));
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
text.getSiblings().add(new TextComponent(" "));
|
|
|
|
|
|
|
|
option = new TextComponent("Cancel");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFF0000)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit cancel")));
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
|
|
|
|
prefix.getSiblings().add(text);
|
|
|
|
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDIT_IGNORE_BATTLE:
|
|
|
|
{
|
|
|
|
TextComponent prefix = new TextComponent("TBM: ");
|
|
|
|
prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true));
|
|
|
|
TextComponent text = new TextComponent("ignoreBattle: ");
|
|
|
|
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
|
|
|
|
|
|
|
TextComponent option = new TextComponent("true");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle true")));
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
|
|
|
|
text.getSiblings().add(new TextComponent(" "));
|
|
|
|
|
|
|
|
option = new TextComponent("false");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFF0000)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle false")));
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
|
|
|
|
prefix.getSiblings().add(text);
|
|
|
|
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDIT_ATTACK_POWER:
|
|
|
|
{
|
|
|
|
TextComponent prefix = new TextComponent("TBM: ");
|
|
|
|
prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true));
|
|
|
|
TextComponent text = new TextComponent("attackPower: ");
|
|
|
|
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
|
|
|
|
|
|
|
for(int i = 0; i <= 15; ++i)
|
|
|
|
{
|
|
|
|
TextComponent option = new TextComponent(Integer.toString(i));
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackPower " + Integer.toString(i))));
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
if(i < 15)
|
|
|
|
{
|
|
|
|
text.getSiblings().add(new TextComponent(", "));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
text.getSiblings().add(new TextComponent(" (or use command \"/tbm-edit edit attackPower <integer>\")"));
|
|
|
|
|
|
|
|
prefix.getSiblings().add(text);
|
|
|
|
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDIT_ATTACK_PROBABILITY:
|
|
|
|
{
|
|
|
|
TextComponent prefix = new TextComponent("TBM: ");
|
|
|
|
prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true));
|
|
|
|
TextComponent text = new TextComponent("attackProbability: ");
|
|
|
|
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
|
|
|
|
|
|
|
for(int i = 10; i <= 100; i += 10)
|
|
|
|
{
|
|
|
|
TextComponent option = new TextComponent(Integer.toString(i) + "%");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackProbability " + Integer.toString(i))));
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
if(i < 100)
|
|
|
|
{
|
|
|
|
text.getSiblings().add(new TextComponent(", "));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
text.getSiblings().add(new TextComponent(" (or use command \"/tbm-edit edit attackProbability <percentage-integer>\")"));
|
|
|
|
|
|
|
|
prefix.getSiblings().add(text);
|
|
|
|
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDIT_ATTACK_VARIANCE:
|
|
|
|
{
|
|
|
|
TextComponent prefix = new TextComponent("TBM: ");
|
|
|
|
prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true));
|
|
|
|
TextComponent text = new TextComponent("attackVariance: ");
|
|
|
|
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
|
|
|
|
|
|
|
for(int i = 0; i <= 10; ++i)
|
|
|
|
{
|
|
|
|
TextComponent option = new TextComponent(Integer.toString(i));
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackVariance " + Integer.toString(i))));
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
if(i < 10)
|
|
|
|
{
|
|
|
|
text.getSiblings().add(new TextComponent(", "));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
text.getSiblings().add(new TextComponent(" (or use command \"/tbm-edit edit attackVariance <integer>\")"));
|
|
|
|
|
|
|
|
prefix.getSiblings().add(text);
|
|
|
|
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDIT_ATTACK_EFFECT:
|
|
|
|
{
|
|
|
|
TextComponent prefix = new TextComponent("TBM: ");
|
|
|
|
prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true));
|
|
|
|
TextComponent text = new TextComponent("attackEffect: ");
|
|
|
|
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
|
|
|
|
|
|
|
for(EntityInfo.Effect e : EntityInfo.Effect.values())
|
|
|
|
{
|
|
|
|
TextComponent option = new TextComponent(e.toString());
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffect " + e.toString())));
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
if(e != EntityInfo.Effect.UNKNOWN)
|
|
|
|
{
|
|
|
|
// TODO find a better way to handle printing comma for items before last
|
|
|
|
text.getSiblings().add(new TextComponent(", "));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
prefix.getSiblings().add(text);
|
|
|
|
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDIT_ATTACK_EFFECT_PROBABILITY:
|
|
|
|
{
|
|
|
|
TextComponent prefix = new TextComponent("TBM: ");
|
|
|
|
prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true));
|
|
|
|
TextComponent text = new TextComponent("attackEffectProbability: ");
|
|
|
|
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
|
|
|
|
|
|
|
for(int i = 0; i <= 100; i += 10)
|
|
|
|
{
|
|
|
|
TextComponent option = new TextComponent(Integer.toString(i) + "%");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffectProbability " + Integer.toString(i))));
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
if(i < 100)
|
|
|
|
{
|
|
|
|
text.getSiblings().add(new TextComponent(", "));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
text.getSiblings().add(new TextComponent(" (or use command \"/tbm-edit edit attackEffectProbability <percentage-integer>\")"));
|
|
|
|
|
|
|
|
prefix.getSiblings().add(text);
|
|
|
|
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDIT_DEFENSE_DAMAGE:
|
|
|
|
{
|
|
|
|
TextComponent prefix = new TextComponent("TBM: ");
|
|
|
|
prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true));
|
|
|
|
TextComponent text = new TextComponent("defenseDamage: ");
|
|
|
|
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
|
|
|
|
|
|
|
for(int i = 0; i <= 15; ++i)
|
|
|
|
{
|
|
|
|
TextComponent option = new TextComponent(Integer.toString(i));
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamage " + Integer.toString(i))));
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
if(i < 15)
|
|
|
|
{
|
|
|
|
text.getSiblings().add(new TextComponent(", "));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
text.getSiblings().add(new TextComponent(" (or use command \"/tbm-edit edit defenseDamage <integer>\")"));
|
|
|
|
|
|
|
|
prefix.getSiblings().add(text);
|
|
|
|
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDIT_DEFENSE_DAMAGE_PROBABILITY:
|
|
|
|
{
|
|
|
|
TextComponent prefix = new TextComponent("TBM: ");
|
|
|
|
prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true));
|
|
|
|
TextComponent text = new TextComponent("defenseDamageProbability: ");
|
|
|
|
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
|
|
|
|
|
|
|
for(int i = 0; i <= 100; i += 10)
|
|
|
|
{
|
|
|
|
TextComponent option = new TextComponent(Integer.toString(i) + "%");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamageProbability " + Integer.toString(i))));
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
if(i < 100)
|
|
|
|
{
|
|
|
|
text.getSiblings().add(new TextComponent(", "));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
text.getSiblings().add(new TextComponent(" (or use command \"/tbm-edit edit defenseDamageProbability <percentage-integer>\")"));
|
|
|
|
|
|
|
|
prefix.getSiblings().add(text);
|
|
|
|
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDIT_EVASION:
|
|
|
|
{
|
|
|
|
TextComponent prefix = new TextComponent("TBM: ");
|
|
|
|
prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true));
|
|
|
|
TextComponent text = new TextComponent("evasion: ");
|
|
|
|
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
|
|
|
|
|
|
|
for(int i = 0; i <= 100; i += 10)
|
|
|
|
{
|
|
|
|
TextComponent option = new TextComponent(Integer.toString(i) + "%");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit evasion " + Integer.toString(i))));
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
if(i < 100)
|
|
|
|
{
|
|
|
|
text.getSiblings().add(new TextComponent(", "));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
text.getSiblings().add(new TextComponent(" (or use command \"/tbm-edit edit evasion <percentage-integer>\")"));
|
|
|
|
|
|
|
|
prefix.getSiblings().add(text);
|
|
|
|
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDIT_SPEED:
|
|
|
|
{
|
|
|
|
TextComponent prefix = new TextComponent("TBM: ");
|
|
|
|
prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true));
|
|
|
|
TextComponent text = new TextComponent("speed: ");
|
|
|
|
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
|
|
|
|
|
|
|
for(int i = 0; i <= 100; i += 10)
|
|
|
|
{
|
|
|
|
TextComponent option = new TextComponent(Integer.toString(i));
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit speed " + Integer.toString(i))));
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
if(i < 100)
|
|
|
|
{
|
|
|
|
text.getSiblings().add(new TextComponent(", "));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
text.getSiblings().add(new TextComponent(" (or use command \"/tbm-edit edit speed <integer>\")"));
|
|
|
|
|
|
|
|
prefix.getSiblings().add(text);
|
|
|
|
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDIT_CATEGORY:
|
|
|
|
{
|
|
|
|
TextComponent prefix = new TextComponent("TBM: ");
|
|
|
|
prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true));
|
|
|
|
TextComponent text = new TextComponent("category: ");
|
|
|
|
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
|
|
|
|
|
|
|
TextComponent option = new TextComponent("monster");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category monster")));
|
|
|
|
if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("monster"))
|
|
|
|
{
|
|
|
|
TextComponent optionInfo = new TextComponent("(battle-");
|
|
|
|
optionInfo.setStyle(optionInfo.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
TextComponent optionInfoBool = new TextComponent("disabled");
|
|
|
|
optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(TextColor.fromRgb(0xFFFF0000)));
|
|
|
|
optionInfo.getSiblings().add(optionInfoBool);
|
|
|
|
optionInfo.getSiblings().add(new TextComponent(")"));
|
|
|
|
option.getSiblings().add(optionInfo);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TextComponent optionInfo = new TextComponent("(battle-");
|
|
|
|
optionInfo.setStyle(optionInfo.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
TextComponent optionInfoBool = new TextComponent("enabled");
|
|
|
|
optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)));
|
|
|
|
optionInfo.getSiblings().add(optionInfoBool);
|
|
|
|
optionInfo.getSiblings().add(new TextComponent(")"));
|
|
|
|
option.getSiblings().add(optionInfo);
|
|
|
|
}
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
text.getSiblings().add(new TextComponent(", "));
|
|
|
|
|
|
|
|
option = new TextComponent("animal");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category animal")));
|
|
|
|
if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("animal"))
|
|
|
|
{
|
|
|
|
TextComponent optionInfo = new TextComponent("(battle-");
|
|
|
|
optionInfo.setStyle(optionInfo.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
TextComponent optionInfoBool = new TextComponent("disabled");
|
|
|
|
optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(TextColor.fromRgb(0xFFFF0000)));
|
|
|
|
optionInfo.getSiblings().add(optionInfoBool);
|
|
|
|
optionInfo.getSiblings().add(new TextComponent(")"));
|
|
|
|
option.getSiblings().add(optionInfo);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TextComponent optionInfo = new TextComponent("(battle-");
|
|
|
|
optionInfo.setStyle(optionInfo.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
TextComponent optionInfoBool = new TextComponent("enabled");
|
|
|
|
optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)));
|
|
|
|
optionInfo.getSiblings().add(optionInfoBool);
|
|
|
|
optionInfo.getSiblings().add(new TextComponent(")"));
|
|
|
|
option.getSiblings().add(optionInfo);
|
|
|
|
}
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
text.getSiblings().add(new TextComponent(", "));
|
|
|
|
|
|
|
|
option = new TextComponent("passive");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category passive")));
|
|
|
|
if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("passive"))
|
|
|
|
{
|
|
|
|
TextComponent optionInfo = new TextComponent("(battle-");
|
|
|
|
optionInfo.setStyle(optionInfo.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
TextComponent optionInfoBool = new TextComponent("disabled");
|
|
|
|
optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(TextColor.fromRgb(0xFFFF0000)));
|
|
|
|
optionInfo.getSiblings().add(optionInfoBool);
|
|
|
|
optionInfo.getSiblings().add(new TextComponent(")"));
|
|
|
|
option.getSiblings().add(optionInfo);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TextComponent optionInfo = new TextComponent("(battle-");
|
|
|
|
optionInfo.setStyle(optionInfo.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
TextComponent optionInfoBool = new TextComponent("enabled");
|
|
|
|
optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)));
|
|
|
|
optionInfo.getSiblings().add(optionInfoBool);
|
|
|
|
optionInfo.getSiblings().add(new TextComponent(")"));
|
|
|
|
option.getSiblings().add(optionInfo);
|
|
|
|
}
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
text.getSiblings().add(new TextComponent(", "));
|
|
|
|
|
|
|
|
option = new TextComponent("boss");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category boss")));
|
|
|
|
if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("boss"))
|
|
|
|
{
|
|
|
|
TextComponent optionInfo = new TextComponent("(battle-");
|
|
|
|
optionInfo.setStyle(optionInfo.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
TextComponent optionInfoBool = new TextComponent("disabled");
|
|
|
|
optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(TextColor.fromRgb(0xFFFF0000)));
|
|
|
|
optionInfo.getSiblings().add(optionInfoBool);
|
|
|
|
optionInfo.getSiblings().add(new TextComponent(")"));
|
|
|
|
option.getSiblings().add(optionInfo);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TextComponent optionInfo = new TextComponent("(battle-");
|
|
|
|
optionInfo.setStyle(optionInfo.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
TextComponent optionInfoBool = new TextComponent("enabled");
|
|
|
|
optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)));
|
|
|
|
optionInfo.getSiblings().add(optionInfoBool);
|
|
|
|
optionInfo.getSiblings().add(new TextComponent(")"));
|
|
|
|
option.getSiblings().add(optionInfo);
|
|
|
|
}
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
text.getSiblings().add(new TextComponent(", "));
|
|
|
|
|
|
|
|
option = new TextComponent("player");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category player")));
|
|
|
|
if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("player"))
|
|
|
|
{
|
|
|
|
TextComponent optionInfo = new TextComponent("(battle-");
|
|
|
|
optionInfo.setStyle(optionInfo.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
TextComponent optionInfoBool = new TextComponent("disabled");
|
|
|
|
optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(TextColor.fromRgb(0xFFFF0000)));
|
|
|
|
optionInfo.getSiblings().add(optionInfoBool);
|
|
|
|
optionInfo.getSiblings().add(new TextComponent(")"));
|
|
|
|
option.getSiblings().add(optionInfo);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TextComponent optionInfo = new TextComponent("(battle-");
|
|
|
|
optionInfo.setStyle(optionInfo.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
|
|
TextComponent optionInfoBool = new TextComponent("enabled");
|
|
|
|
optionInfoBool.setStyle(optionInfoBool.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)));
|
|
|
|
optionInfo.getSiblings().add(optionInfoBool);
|
|
|
|
optionInfo.getSiblings().add(new TextComponent(")"));
|
|
|
|
option.getSiblings().add(optionInfo);
|
|
|
|
}
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
|
|
|
|
text.getSiblings().add(new TextComponent(" (or use command \"/tbm-edit edit category <string>\")"));
|
|
|
|
|
|
|
|
prefix.getSiblings().add(text);
|
|
|
|
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDIT_DECISION_ATTACK:
|
|
|
|
{
|
|
|
|
TextComponent prefix = new TextComponent("TBM: ");
|
|
|
|
prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true));
|
|
|
|
TextComponent text = new TextComponent("decisionAttack: ");
|
|
|
|
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
|
|
|
|
|
|
|
for(int i = 0; i <= 100; i += 10)
|
|
|
|
{
|
|
|
|
TextComponent option = new TextComponent(Integer.toString(i) + "%");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionAttack " + Integer.toString(i))));
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
if(i < 100)
|
|
|
|
{
|
|
|
|
text.getSiblings().add(new TextComponent(", "));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
prefix.getSiblings().add(text);
|
|
|
|
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDIT_DECISION_DEFEND:
|
|
|
|
{
|
|
|
|
TextComponent prefix = new TextComponent("TBM: ");
|
|
|
|
prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true));
|
|
|
|
TextComponent text = new TextComponent("decisionDefend: ");
|
|
|
|
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
|
|
|
|
|
|
|
for(int i = 0; i <= 100; i += 10)
|
|
|
|
{
|
|
|
|
TextComponent option = new TextComponent(Integer.toString(i) + "%");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionDefend " + Integer.toString(i))));
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
if(i < 100)
|
|
|
|
{
|
|
|
|
text.getSiblings().add(new TextComponent(", "));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
prefix.getSiblings().add(text);
|
|
|
|
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDIT_DECISION_FLEE:
|
|
|
|
{
|
|
|
|
TextComponent prefix = new TextComponent("TBM: ");
|
|
|
|
prefix.setStyle(prefix.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withBold(true));
|
|
|
|
TextComponent text = new TextComponent("decisionFlee: ");
|
|
|
|
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
|
|
|
|
|
|
|
for(int i = 0; i <= 100; i += 10)
|
|
|
|
{
|
|
|
|
TextComponent option = new TextComponent(Integer.toString(i) + "%");
|
|
|
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionFlee " + Integer.toString(i))));
|
|
|
|
text.getSiblings().add(option);
|
|
|
|
if(i < 100)
|
|
|
|
{
|
|
|
|
text.getSiblings().add(new TextComponent(", "));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
prefix.getSiblings().add(text);
|
|
|
|
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-09-12 06:39:55 +00:00
|
|
|
}
|