Updated for mcf 1.16.3-34.1.0

This commit is contained in:
Stephen Seo 2020-11-12 17:10:01 +09:00
parent 978713178d
commit 61e0fb02e6
18 changed files with 596 additions and 462 deletions

2
.gitignore vendored
View file

@ -20,3 +20,5 @@ build
# other # other
eclipse eclipse
run run
logs/

View file

@ -1,5 +1,13 @@
# Upcoming changes # Upcoming changes
# Version 1.10
Updated for 1.16.3
Compiled against forge version "1.16.3-34.1.0"
However, MP3 playing seems to not work sometimes.
# Version 1.9 # Version 1.9
Updated mod for 1.14.4 Updated mod for 1.14.4

View file

@ -14,7 +14,7 @@ apply plugin: 'eclipse'
//apply plugin: 'maven-publish' //apply plugin: 'maven-publish'
apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'com.github.johnrengelman.shadow'
version = "1.9" version = "1.10"
group = "com.burnedkirby.TurnBasedMinecraft" group = "com.burnedkirby.TurnBasedMinecraft"
archivesBaseName = "TurnBasedMinecraft" archivesBaseName = "TurnBasedMinecraft"
@ -26,7 +26,7 @@ minecraft {
// stable_# Stables are built at the discretion of the MCP team. // stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work. // Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace. // Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'snapshot', version: '20190719-1.14.3' mappings channel: 'snapshot', version: '20200514-1.16'
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
@ -90,7 +90,7 @@ dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it. // The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.14.4-28.1.0' minecraft 'net.minecraftforge:forge:1.16.3-34.1.0'
// You may put jars on which you depend on in ./libs or you may define them like so.. // You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier" // compile "some.group:artifact:version:classifier"

View file

@ -11,9 +11,13 @@ import com.burnedkirby.TurnBasedMinecraft.common.Config;
import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod; import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod;
import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketBattleDecision; import com.burnedkirby.TurnBasedMinecraft.common.networking.PacketBattleDecision;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.StringTextComponent;
public class BattleGui extends Screen { public class BattleGui extends Screen {
@ -23,6 +27,7 @@ public class BattleGui extends Screen {
private MenuState state; private MenuState state;
private boolean stateChanged; private boolean stateChanged;
private String info; private String info;
private Matrix4f identity;
private enum MenuState { private enum MenuState {
MAIN_MENU(0), ATTACK_TARGET(1), ITEM_ACTION(2), WAITING(3), SWITCH_ITEM(4), USE_ITEM(5); MAIN_MENU(0), ATTACK_TARGET(1), ITEM_ACTION(2), WAITING(3), SWITCH_ITEM(4), USE_ITEM(5);
@ -85,6 +90,8 @@ public class BattleGui extends Screen {
elapsedTime = 0; elapsedTime = 0;
state = MenuState.MAIN_MENU; state = MenuState.MAIN_MENU;
stateChanged = true; stateChanged = true;
identity = new Matrix4f();
identity.setIdentity();
} }
private void setState(MenuState state) { private void setState(MenuState state) {
@ -119,21 +126,26 @@ public class BattleGui extends Screen {
} }
stateChanged = false; stateChanged = false;
buttons.clear(); // field_230705_e_ is probably a list of buttons
children.clear(); field_230705_e_.clear();
// field_230710_m_ is probably a list of gui elements
field_230710_m_.clear();
switch (state) { switch (state) {
case MAIN_MENU: case MAIN_MENU:
info = "What will you do?"; info = "What will you do?";
addButton(new Button(width * 3 / 7 - 25, 40, 50, 20, "Attack", (button) -> { // func_230480_a_ is probably addButton
// field_230708_k_ is probably width
// field_230709_l_ is probably height
func_230480_a_(new Button(field_230708_k_ * 3 / 7 - 25, 40, 50, 20, new StringTextComponent("Attack"), (button) -> {
buttonActionEvent(button, ButtonAction.ATTACK); buttonActionEvent(button, ButtonAction.ATTACK);
})); }));
addButton(new Button(width * 4 / 7 - 25, 40, 50, 20, "Defend", (button) -> { func_230480_a_(new Button(field_230708_k_ * 4 / 7 - 25, 40, 50, 20, new StringTextComponent("Defend"), (button) -> {
buttonActionEvent(button, ButtonAction.DEFEND); buttonActionEvent(button, ButtonAction.DEFEND);
})); }));
addButton(new Button(width * 3 / 7 - 25, 60, 50, 20, "Item", (button) -> { func_230480_a_(new Button(field_230708_k_ * 3 / 7 - 25, 60, 50, 20, new StringTextComponent("Item"), (button) -> {
buttonActionEvent(button, ButtonAction.ITEM); buttonActionEvent(button, ButtonAction.ITEM);
})); }));
addButton(new Button(width * 4 / 7 - 25, 60, 50, 20, "Flee", (button) -> { func_230480_a_(new Button(field_230708_k_ * 4 / 7 - 25, 60, 50, 20, new StringTextComponent("Flee"), (button) -> {
buttonActionEvent(button, ButtonAction.FLEE); buttonActionEvent(button, ButtonAction.FLEE);
})); }));
break; break;
@ -144,11 +156,11 @@ public class BattleGui extends Screen {
for (Map.Entry<Integer, Combatant> e : TurnBasedMinecraftMod.proxy.getLocalBattle() for (Map.Entry<Integer, Combatant> e : TurnBasedMinecraftMod.proxy.getLocalBattle()
.getSideAEntrySet()) { .getSideAEntrySet()) {
if (e.getValue().entity != null) { if (e.getValue().entity != null) {
addButton(new EntitySelectionButton(width / 4 - 60, y, 120, 20, e.getValue().entity.getName().getString(), e.getKey(), true, (button) -> { func_230480_a_(new EntitySelectionButton(field_230708_k_ / 4 - 60, y, 120, 20, e.getValue().entity.getName().getString(), e.getKey(), true, (button) -> {
buttonActionEvent(button, ButtonAction.ATTACK_TARGET); buttonActionEvent(button, ButtonAction.ATTACK_TARGET);
})); }));
} else { } else {
addButton(new EntitySelectionButton(width / 4 - 60, y, 120, 20, "Unknown", e.getKey(), true, (button) -> { func_230480_a_(new EntitySelectionButton(field_230708_k_ / 4 - 60, y, 120, 20, "Unknown", e.getKey(), true, (button) -> {
buttonActionEvent(button, ButtonAction.ATTACK_TARGET); buttonActionEvent(button, ButtonAction.ATTACK_TARGET);
})); }));
} }
@ -162,11 +174,11 @@ public class BattleGui extends Screen {
for (Map.Entry<Integer, Combatant> e : TurnBasedMinecraftMod.proxy.getLocalBattle() for (Map.Entry<Integer, Combatant> e : TurnBasedMinecraftMod.proxy.getLocalBattle()
.getSideBEntrySet()) { .getSideBEntrySet()) {
if (e.getValue().entity != null) { if (e.getValue().entity != null) {
addButton(new EntitySelectionButton(width * 3 / 4 - 60, y, 120, 20, e.getValue().entity.getName().getString(), e.getKey(), false, (button) -> { func_230480_a_(new EntitySelectionButton(field_230708_k_ * 3 / 4 - 60, y, 120, 20, e.getValue().entity.getName().getString(), e.getKey(), false, (button) -> {
buttonActionEvent(button, ButtonAction.ATTACK_TARGET); buttonActionEvent(button, ButtonAction.ATTACK_TARGET);
})); }));
} else { } else {
addButton(new EntitySelectionButton(width * 3 / 4 - 60, y, 120, 20, "Unknown", e.getKey(), false, (button) -> { func_230480_a_(new EntitySelectionButton(field_230708_k_ * 3 / 4 - 60, y, 120, 20, "Unknown", e.getKey(), false, (button) -> {
buttonActionEvent(button, ButtonAction.ATTACK_TARGET); buttonActionEvent(button, ButtonAction.ATTACK_TARGET);
})); }));
} }
@ -175,19 +187,19 @@ public class BattleGui extends Screen {
} catch (ConcurrentModificationException e) { } catch (ConcurrentModificationException e) {
// ignored // ignored
} }
addButton(new Button(width / 2 - 30, height - 120, 60, 20, "Cancel", (button) -> { func_230480_a_(new Button(field_230708_k_ / 2 - 30, field_230709_l_ - 120, 60, 20, new StringTextComponent("Cancel"), (button) -> {
buttonActionEvent(button, ButtonAction.CANCEL); buttonActionEvent(button, ButtonAction.CANCEL);
})); }));
break; break;
case ITEM_ACTION: case ITEM_ACTION:
info = "What will you do with an item?"; info = "What will you do with an item?";
addButton(new Button(width * 1 / 4 - 40, height - 120, 80, 20, "Switch Held", (button) -> { func_230480_a_(new Button(field_230708_k_ * 1 / 4 - 40, field_230709_l_ - 120, 80, 20, new StringTextComponent("Switch Held"), (button) -> {
buttonActionEvent(button, ButtonAction.SWITCH_HELD_ITEM); buttonActionEvent(button, ButtonAction.SWITCH_HELD_ITEM);
})); }));
addButton(new Button(width * 2 / 4 - 40, height - 120, 80, 20, "Use", (button) -> { func_230480_a_(new Button(field_230708_k_ * 2 / 4 - 40, field_230709_l_ - 120, 80, 20, new StringTextComponent("Use"), (button) -> {
buttonActionEvent(button, ButtonAction.DECIDE_USE_ITEM); buttonActionEvent(button, ButtonAction.DECIDE_USE_ITEM);
})); }));
addButton(new Button(width * 3 / 4 - 40, height - 120, 80, 20, "Cancel", (button) -> { func_230480_a_(new Button(field_230708_k_ * 3 / 4 - 40, field_230709_l_ - 120, 80, 20, new StringTextComponent("Cancel"), (button) -> {
buttonActionEvent(button, ButtonAction.CANCEL); buttonActionEvent(button, ButtonAction.CANCEL);
})); }));
break; break;
@ -197,22 +209,22 @@ public class BattleGui extends Screen {
case SWITCH_ITEM: case SWITCH_ITEM:
info = "To which item will you switch to?"; info = "To which item will you switch to?";
for (int i = 0; i < 9; ++i) { for (int i = 0; i < 9; ++i) {
addButton(new ItemSelectionButton(width / 2 - 88 + i * 20, height - 19, 16, 16, "", i, (button) -> { func_230480_a_(new ItemSelectionButton(field_230708_k_ / 2 - 88 + i * 20, field_230709_l_ - 19, 16, 16, "", i, (button) -> {
buttonActionEvent(button, ButtonAction.DO_ITEM_SWITCH); buttonActionEvent(button, ButtonAction.DO_ITEM_SWITCH);
})); }));
} }
addButton(new Button(width / 2 - 40, height - 120, 80, 20, "Cancel", (button) -> { func_230480_a_(new Button(field_230708_k_ / 2 - 40, field_230709_l_ - 120, 80, 20, new StringTextComponent("Cancel"), (button) -> {
buttonActionEvent(button, ButtonAction.CANCEL); buttonActionEvent(button, ButtonAction.CANCEL);
})); }));
break; break;
case USE_ITEM: case USE_ITEM:
info = "Which item will you use?"; info = "Which item will you use?";
for (int i = 0; i < 9; ++i) { for (int i = 0; i < 9; ++i) {
addButton(new ItemSelectionButton(width / 2 - 88 + i * 20, height - 19, 16, 16, "", i, (button) -> { func_230480_a_(new ItemSelectionButton(field_230708_k_ / 2 - 88 + i * 20, field_230709_l_ - 19, 16, 16, "", i, (button) -> {
buttonActionEvent(button, ButtonAction.DO_USE_ITEM); buttonActionEvent(button, ButtonAction.DO_USE_ITEM);
})); }));
} }
addButton(new Button(width / 2 - 40, height - 120, 80, 20, "Cancel", (button) -> { func_230480_a_(new Button(field_230708_k_ / 2 - 40, field_230709_l_ - 120, 80, 20, new StringTextComponent("Cancel"), (button) -> {
buttonActionEvent(button, ButtonAction.CANCEL); buttonActionEvent(button, ButtonAction.CANCEL);
})); }));
break; break;
@ -220,10 +232,10 @@ public class BattleGui extends Screen {
} }
@Override @Override
public void render(int mouseX, int mouseY, float partialTicks) { public void func_230430_a_(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
if (TurnBasedMinecraftMod.proxy.getLocalBattle() == null) { if (TurnBasedMinecraftMod.proxy.getLocalBattle() == null) {
// drawHoveringText("Waiting...", width / 2 - 50, height / 2); // drawHoveringText("Waiting...", field_230708_k_ / 2 - 50, field_230709_l_ / 2);
getMinecraft().fontRenderer.drawString("Waiting...", width / 2 - 50, height / 2, 0xFFFFFFFF); drawString("Waiting...", field_230708_k_ / 2 - 50, field_230709_l_ / 2, 0xFFFFFFFF);
return; return;
} }
if (TurnBasedMinecraftMod.proxy.getLocalBattle().getState() == Battle.State.DECISION if (TurnBasedMinecraftMod.proxy.getLocalBattle().getState() == Battle.State.DECISION
@ -239,7 +251,7 @@ public class BattleGui extends Screen {
updateState(); updateState();
super.render(mouseX, mouseY, partialTicks); super.func_230430_a_(matrixStack, mouseX, mouseY, partialTicks);
String timeRemainingString = "Time remaining: "; String timeRemainingString = "Time remaining: ";
int timeRemainingInt = timeRemaining.get(); int timeRemainingInt = timeRemaining.get();
@ -251,12 +263,13 @@ public class BattleGui extends Screen {
timeRemainingString += "\u00A7c"; timeRemainingString += "\u00A7c";
} }
timeRemainingString += Integer.toString(timeRemainingInt); timeRemainingString += Integer.toString(timeRemainingInt);
int stringWidth = getMinecraft().fontRenderer.getStringWidth(timeRemainingString); int stringWidth = field_230712_o_.getStringWidth(timeRemainingString);
fill(width / 2 - stringWidth / 2, 5, width / 2 + stringWidth / 2, 15, 0x70000000); // func_238467_a_ is probably fill
getMinecraft().fontRenderer.drawString(timeRemainingString, width / 2 - stringWidth / 2, 5, 0xFFFFFFFF); func_238467_a_(matrixStack, field_230708_k_ / 2 - stringWidth / 2, 5, field_230708_k_ / 2 + stringWidth / 2, 15, 0x70000000);
stringWidth = getMinecraft().fontRenderer.getStringWidth(info); drawString(timeRemainingString, field_230708_k_ / 2 - stringWidth / 2, 5, 0xFFFFFFFF);
fill(width / 2 - stringWidth / 2, 20, width / 2 + stringWidth / 2, 30, 0x70000000); stringWidth = field_230712_o_.getStringWidth(info);
getMinecraft().fontRenderer.drawString(info, width / 2 - stringWidth / 2, 20, 0xFFFFFFFF); func_238467_a_(matrixStack, field_230708_k_ / 2 - stringWidth / 2, 20, field_230708_k_ / 2 + stringWidth / 2, 30, 0x70000000);
drawString(info, field_230708_k_ / 2 - stringWidth / 2, 20, 0xFFFFFFFF);
} }
protected void buttonActionEvent(Button button, ButtonAction action) { protected void buttonActionEvent(Button button, ButtonAction action) {
@ -322,19 +335,21 @@ public class BattleGui extends Screen {
} }
} }
@Override // @Override
protected void init() { // protected void init() {
} // }
// func_231177_au__ is probably isPauseScreen
@Override @Override
public boolean isPauseScreen() { public boolean func_231177_au__() {
return false; return false;
} }
// func_231046_a_ is probably keyPressed
@Override @Override
public boolean keyPressed(int a, int b, int c) { public boolean func_231046_a_(int a, int b, int c) {
if (getMinecraft().player.isCreative()) { if (getMinecraft().player.isCreative()) {
return super.keyPressed(a, b, c); return super.func_231046_a_(a, b, c);
} }
return false; // TODO verify return value return false; // TODO verify return value
} }
@ -342,4 +357,10 @@ public class BattleGui extends Screen {
public void setTimeRemaining(int remaining) { public void setTimeRemaining(int remaining) {
timeRemaining.set(remaining); timeRemaining.set(remaining);
} }
private void drawString(String string, int x, int y, int color) {
IRenderTypeBuffer.Impl irendertypebuffer$impl = IRenderTypeBuffer.getImpl(Tessellator.getInstance().getBuffer());
field_230712_o_.renderString(string, x, y, color, true, identity, irendertypebuffer$impl, true, 0x7F000000, 15728880);
irendertypebuffer$impl.finish();
}
} }

View file

@ -24,6 +24,7 @@ public class BattleMusic
private File nextBattle; private File nextBattle;
private File nextSilly; private File nextSilly;
private Sequencer sequencer; private Sequencer sequencer;
private AudioInputStream wavInputStream;
private Clip clip; private Clip clip;
private boolean playingIsSilly; private boolean playingIsSilly;
private boolean isPlaying; private boolean isPlaying;
@ -45,15 +46,17 @@ public class BattleMusic
sequencer.open(); sequencer.open();
} catch (Throwable t) { } catch (Throwable t) {
logger.error("Failed to load midi sequencer"); logger.error("Failed to load midi sequencer");
t.printStackTrace();
sequencer = null; sequencer = null;
} }
try { // try {
clip = AudioSystem.getClip(); // clip = AudioSystem.getClip();
} catch(Throwable t) { // } catch(Throwable t) {
logger.error("Failed to load clip (for wav)"); // logger.error("Failed to load clip (for wav)");
clip = null; // t.printStackTrace();
} // clip = null;
// }
File battleMusicFolder = new File(TurnBasedMinecraftMod.MUSIC_BATTLE); File battleMusicFolder = new File(TurnBasedMinecraftMod.MUSIC_BATTLE);
File sillyMusicFolder = new File(TurnBasedMinecraftMod.MUSIC_SILLY); File sillyMusicFolder = new File(TurnBasedMinecraftMod.MUSIC_SILLY);
@ -204,19 +207,22 @@ public class BattleMusic
} catch (Throwable t) } catch (Throwable t)
{ {
logger.error("Failed to play battle music (midi)"); logger.error("Failed to play battle music (midi)");
t.printStackTrace();
return; return;
} }
sequencer.setLoopCount(Sequencer.LOOP_CONTINUOUSLY); sequencer.setLoopCount(Sequencer.LOOP_CONTINUOUSLY);
sequencer.start(); sequencer.start();
logger.info("Played music (midi) " + next.getName());
} }
else if(suffix.equals("wav") && clip != null) else if(suffix.equals("wav"))
{ {
if(sequencer != null && sequencer.isRunning()) if(sequencer != null && sequencer.isRunning())
{ {
sequencer.stop(); sequencer.stop();
} }
if(clip.isActive()) if(clip != null && clip.isActive())
{ {
clip.stop(); clip.stop();
clip.close(); clip.close();
@ -229,10 +235,18 @@ public class BattleMusic
try try
{ {
clip.open(AudioSystem.getAudioInputStream(next)); if(wavInputStream != null) {
wavInputStream.close();
}
wavInputStream = AudioSystem.getAudioInputStream(next);
AudioFormat format = wavInputStream.getFormat();
DataLine.Info info = new DataLine.Info(Clip.class, format);
clip = (Clip) AudioSystem.getLine(info);
clip.open(wavInputStream);
} catch(Throwable t) } catch(Throwable t)
{ {
logger.error("Failed to play battle music (wav)"); logger.error("Failed to play battle music (wav)");
t.printStackTrace();
return; return;
} }
@ -242,6 +256,8 @@ public class BattleMusic
clip.loop(Clip.LOOP_CONTINUOUSLY); clip.loop(Clip.LOOP_CONTINUOUSLY);
clip.start(); clip.start();
logger.info("Playing music (wav) " + next.getName());
} }
else if(suffix.equals("mp3")) else if(suffix.equals("mp3"))
{ {
@ -279,6 +295,7 @@ public class BattleMusic
catch (Throwable t) catch (Throwable t)
{ {
logger.error("Failed to play battle music (mp3)"); logger.error("Failed to play battle music (mp3)");
t.printStackTrace();
return; return;
} }
} }

View file

@ -6,11 +6,14 @@ import com.burnedkirby.TurnBasedMinecraft.common.CommonProxy;
import net.minecraft.client.GameSettings; import net.minecraft.client.GameSettings;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.util.RegistryKey;
import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundCategory;
import net.minecraft.util.text.Color;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import java.util.UUID;
public class ClientProxy extends CommonProxy public class ClientProxy extends CommonProxy
{ {
@ -158,17 +161,21 @@ public class ClientProxy extends CommonProxy
public void displayString(String message) public void displayString(String message)
{ {
ITextComponent prefix = new StringTextComponent("TBM: "); ITextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true); // func_240718_a_ is set color
// func_240713_a_ is set bold
prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true);
ITextComponent text = new StringTextComponent(message); ITextComponent text = new StringTextComponent(message);
prefix.appendSibling(text); prefix.getSiblings().add(text);
text.getStyle().setColor(TextFormatting.WHITE).setBold(false); text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false);
Minecraft.getInstance().player.sendMessage(prefix); // UUID is required by sendMessage, but appears to be unused, so just give dummy UUID
Minecraft.getInstance().player.sendMessage(prefix, UUID.randomUUID());
} }
@Override @Override
public void displayTextComponent(ITextComponent text) public void displayTextComponent(ITextComponent text)
{ {
Minecraft.getInstance().player.sendMessage(text); // UUID is required by sendMessage, but appears to be unused, so just give dummy UUID
Minecraft.getInstance().player.sendMessage(text, UUID.randomUUID());
} }
private void checkBattleTypes() private void checkBattleTypes()
@ -228,11 +235,11 @@ public class ClientProxy extends CommonProxy
@Override @Override
public void createLocalBattle(int id) public void createLocalBattle(int id)
{ {
localBattle = new Battle(null, id, null, null, false, Minecraft.getInstance().world.dimension.getType()); localBattle = new Battle(null, id, null, null, false, Minecraft.getInstance().world.func_234923_W_());
} }
@Override @Override
public Entity getEntity(int id, DimensionType dim) { public Entity getEntity(int id, RegistryKey<World> dim) {
return Minecraft.getInstance().world.getEntityByID(id); return Minecraft.getInstance().world.getEntityByID(id);
} }
} }

View file

@ -1,78 +1,99 @@
package com.burnedkirby.TurnBasedMinecraft.client; package com.burnedkirby.TurnBasedMinecraft.client;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.util.text.StringTextComponent;
public class EntitySelectionButton extends Button public class EntitySelectionButton extends Button {
{
private int entityID; private int entityID;
private boolean isSideA; private boolean isSideA;
public EntitySelectionButton(int x, int y, int widthIn, int heightIn, String buttonText, int entityID, boolean isSideA, Button.IPressable onPress) { public EntitySelectionButton(int x, int y, int widthIn, int heightIn, String buttonText, int entityID, boolean isSideA, Button.IPressable onPress) {
super(x, y, widthIn, heightIn, buttonText, onPress); super(x, y, widthIn, heightIn, new StringTextComponent(buttonText), onPress);
this.entityID = entityID; this.entityID = entityID;
this.isSideA = isSideA; this.isSideA = isSideA;
} }
public int getID() { public int getID() {
return entityID; return entityID;
} }
public boolean getIsSideA() { public boolean getIsSideA() {
return isSideA; return isSideA;
} }
@Override @Override
public void render(int mouseX, int mouseY, float partialTicks) { public void func_230430_a_(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
super.render(mouseX, mouseY, partialTicks); super.func_230430_a_(matrixStack, mouseX, mouseY, partialTicks);
Entity e = Minecraft.getInstance().world.getEntityByID(entityID); Entity e = Minecraft.getInstance().world.getEntityByID(entityID);
if(e != null && e instanceof LivingEntity && ((LivingEntity)e).isAlive()) { if (e != null && e instanceof LivingEntity && ((LivingEntity) e).isAlive()) {
int health = (int)(((LivingEntity)e).getHealth() + 0.5f); int health = (int) (((LivingEntity) e).getHealth() + 0.5f);
int xpos = x; int xpos = getX();
int xoffset; int xoffset;
if(isSideA) { if (isSideA) {
xpos += width + 4; xpos += getWidth() + 4;
xoffset = 4; xoffset = 4;
} else { } else {
xpos -= 6; xpos -= 6;
xoffset = -4; xoffset = -4;
} }
if(health > 200) { if (health > 200) {
fill(xpos, y + height * 4 / 5, xpos + 2, y + height , 0xFFFF0000); fill(matrixStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000);
fill(xpos, y + height * 3 / 5, xpos + 2, y + height * 4 / 5, 0xFFFFFF00); fill(matrixStack, xpos, getY() + getHeight() * 3 / 5, xpos + 2, getY() + getHeight() * 4 / 5, 0xFFFFFF00);
fill(xpos, y + height * 2 / 5, xpos + 2, y + height * 3 / 5, 0xFF00FF00); fill(matrixStack, xpos, getY() + getHeight() * 2 / 5, xpos + 2, getY() + getHeight() * 3 / 5, 0xFF00FF00);
fill(xpos, y + height / 5, xpos + 2, y + height * 2 / 5, 0xFF00FFFF); fill(matrixStack, xpos, getY() + getHeight() / 5, xpos + 2, getY() + getHeight() * 2 / 5, 0xFF00FFFF);
fill(xpos, y , xpos + 2, y + height / 5, 0xFF0000FF); fill(matrixStack, xpos, getY(), xpos + 2, getY() + getHeight() / 5, 0xFF0000FF);
int healthHeight = ((health - 200) * height / 100); int healthHeight = ((health - 200) * getHeight() / 100);
fill(xpos + xoffset, y + height - healthHeight, xpos + xoffset + 2, y + height, 0xFFFFFFFF); fill(matrixStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFFFFFFFF);
} else if(health > 100) { } else if (health > 100) {
fill(xpos, y + height * 4 / 5, xpos + 2, y + height , 0xFFFF0000); fill(matrixStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000);
fill(xpos, y + height * 3 / 5, xpos + 2, y + height * 4 / 5, 0xFFFFFF00); fill(matrixStack, xpos, getY() + getHeight() * 3 / 5, xpos + 2, getY() + getHeight() * 4 / 5, 0xFFFFFF00);
fill(xpos, y + height * 2 / 5, xpos + 2, y + height * 3 / 5, 0xFF00FF00); fill(matrixStack, xpos, getY() + getHeight() * 2 / 5, xpos + 2, getY() + getHeight() * 3 / 5, 0xFF00FF00);
fill(xpos, y + height / 5, xpos + 2, y + height * 2 / 5, 0xFF00FFFF); fill(matrixStack, xpos, getY() + getHeight() / 5, xpos + 2, getY() + getHeight() * 2 / 5, 0xFF00FFFF);
int healthHeight = ((health - 100) * height / 100); int healthHeight = ((health - 100) * getHeight() / 100);
fill(xpos + xoffset, y + height - healthHeight, xpos + xoffset + 2, y + height, 0xFF0000FF); fill(matrixStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFF0000FF);
} else if(health > 50) { } else if (health > 50) {
fill(xpos, y + height * 4 / 5, xpos + 2, y + height , 0xFFFF0000); fill(matrixStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000);
fill(xpos, y + height * 3 / 5, xpos + 2, y + height * 4 / 5, 0xFFFFFF00); fill(matrixStack, xpos, getY() + getHeight() * 3 / 5, xpos + 2, getY() + getHeight() * 4 / 5, 0xFFFFFF00);
fill(xpos, y + height * 2 / 5, xpos + 2, y + height * 3 / 5, 0xFF00FF00); fill(matrixStack, xpos, getY() + getHeight() * 2 / 5, xpos + 2, getY() + getHeight() * 3 / 5, 0xFF00FF00);
int healthHeight = ((health - 50) * height / 50); int healthHeight = ((health - 50) * getHeight() / 50);
fill(xpos + xoffset, y + height - healthHeight, xpos + xoffset + 2, y + height, 0xFF00FFFF); fill(matrixStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFF00FFFF);
} else if(health > 20) { } else if (health > 20) {
fill(xpos, y + height * 4 / 5, xpos + 2, y + height , 0xFFFF0000); fill(matrixStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000);
fill(xpos, y + height * 3 / 5, xpos + 2, y + height * 4 / 5, 0xFFFFFF00); fill(matrixStack, xpos, getY() + getHeight() * 3 / 5, xpos + 2, getY() + getHeight() * 4 / 5, 0xFFFFFF00);
int healthHeight = ((health - 20) * height / 30); int healthHeight = ((health - 20) * getHeight() / 30);
fill(xpos + xoffset, y + height - healthHeight, xpos + xoffset + 2, y + height, 0xFF00FF00); fill(matrixStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFF00FF00);
} else if(health > 10) { } else if (health > 10) {
fill(xpos, y + height * 4 / 5, xpos + 2, y + height, 0xFFFF0000); fill(matrixStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000);
int healthHeight = ((health - 10) * height / 10); int healthHeight = ((health - 10) * getHeight() / 10);
fill(xpos + xoffset, y + height - healthHeight, xpos + xoffset + 2, y + height, 0xFFFFFF00); fill(matrixStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFFFFFF00);
} else { } else {
int healthHeight = (health * height / 10); int healthHeight = (health * getHeight() / 10);
fill(xpos + xoffset, y + height - healthHeight, xpos + xoffset + 2, y + height, 0xFFFF0000); fill(matrixStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFFFF0000);
} }
} }
} }
private int getX() {
return field_230690_l_;
}
private int getY() {
return field_230691_m_;
}
private int getWidth() {
return field_230688_j_;
}
private int getHeight() {
return field_230689_k_;
}
private void fill(MatrixStack matrixStack, int x, int y, int width, int height, int color) {
func_238467_a_(matrixStack, x, y, width, height, color);
}
} }

View file

@ -1,29 +1,52 @@
package com.burnedkirby.TurnBasedMinecraft.client; package com.burnedkirby.TurnBasedMinecraft.client;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.util.text.StringTextComponent;
public class ItemSelectionButton extends Button public class ItemSelectionButton extends Button {
{
private int itemStackID; private int itemStackID;
public ItemSelectionButton(int x, int y, int widthIn, int heightIn, String buttonText, int itemStackID, Button.IPressable onPress) { public ItemSelectionButton(int x, int y, int widthIn, int heightIn, String buttonText, int itemStackID, Button.IPressable onPress) {
super(x, y, widthIn, heightIn, buttonText, onPress); super(x, y, widthIn, heightIn, new StringTextComponent(buttonText), onPress);
this.itemStackID = itemStackID; this.itemStackID = itemStackID;
} }
public int getID() { public int getID() {
return itemStackID; return itemStackID;
} }
@Override @Override
public void render(int mouseX, int mouseY, float partialTicks) { public void func_230430_a_(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
if(visible) { // field_230694_p_ is probably isVisible
boolean hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height; if (field_230694_p_) {
if(hovered) { boolean hovered = mouseX >= getX() && mouseY >= getY() && mouseX < getX() + getWidth() && mouseY < getY() + getHeight();
fill(x, y, x + width, y + height, 0x80FFFFFF); if (hovered) {
fill(matrixStack, getX(), getY(), getX() + getWidth(), getY() + getHeight(), 0x80FFFFFF);
} else { } else {
fill(x, y, x + width, y + height, 0x20707070); fill(matrixStack, getX(), getY(), getX() + getWidth(), getY() + getHeight(), 0x20707070);
} }
} }
} }
private int getX() {
return field_230690_l_;
}
private int getY() {
return field_230691_m_;
}
private int getWidth() {
return field_230688_j_;
}
private int getHeight() {
return field_230689_k_;
}
private void fill(MatrixStack matrixStack, int x, int y, int width, int height, int color) {
func_238467_a_(matrixStack, x, y, width, height, color);
}
} }

View file

@ -125,7 +125,7 @@ public class AttackEventHandler
&& event.getEntity() != event.getSource().getTrueSource() && event.getEntity() != event.getSource().getTrueSource()
&& !config.getBattleIgnoringPlayers().contains(event.getSource().getTrueSource().getEntityId()) && !config.getBattleIgnoringPlayers().contains(event.getSource().getTrueSource().getEntityId())
&& !config.getBattleIgnoringPlayers().contains(event.getEntity().getEntityId()) && !config.getBattleIgnoringPlayers().contains(event.getEntity().getEntityId())
&& event.getEntity().dimension == event.getSource().getTrueSource().dimension && event.getEntity().getEntityWorld().func_234923_W_().equals(event.getSource().getTrueSource().getEntityWorld().func_234923_W_())
&& battleManager.checkAttack(event)) && battleManager.checkAttack(event))
{ {
// TurnBasedMinecraftMod.logger.debug("Canceled LivingAttackEvent between " + TurnBasedMinecraftMod.proxy.getAttackingEntity() + " and " + event.getEntity()); // TurnBasedMinecraftMod.logger.debug("Canceled LivingAttackEvent between " + TurnBasedMinecraftMod.proxy.getAttackingEntity() + " and " + event.getEntity());
@ -157,7 +157,7 @@ public class AttackEventHandler
&& event.getTarget() != null && event.getTarget() != null
&& !config.getBattleIgnoringPlayers().contains(event.getEntity().getEntityId()) && !config.getBattleIgnoringPlayers().contains(event.getEntity().getEntityId())
&& !config.getBattleIgnoringPlayers().contains(event.getTarget().getEntityId()) && !config.getBattleIgnoringPlayers().contains(event.getTarget().getEntityId())
&& event.getEntity().dimension == event.getTarget().dimension) && event.getEntity().getEntityWorld().func_234923_W_().equals(event.getTarget().getEntityWorld().func_234923_W_()))
{ {
TurnBasedMinecraftMod.proxy.getBattleManager().checkTargeted(event); TurnBasedMinecraftMod.proxy.getBattleManager().checkTargeted(event);
} }

View file

@ -14,7 +14,9 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.*; import net.minecraft.item.*;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.world.dimension.DimensionType; import net.minecraft.util.RegistryKey;
import net.minecraft.world.DimensionType;
import net.minecraft.world.World;
import net.minecraftforge.fml.network.PacketDistributor; import net.minecraftforge.fml.network.PacketDistributor;
public class Battle public class Battle
@ -42,7 +44,7 @@ public class Battle
public String debugLog; // TODO remove after freeze bug has been found public String debugLog; // TODO remove after freeze bug has been found
private DimensionType dimension; private RegistryKey<World> dimension;
public enum State public enum State
{ {
@ -113,7 +115,7 @@ public class Battle
} }
} }
public Battle(BattleManager battleManager, int id, Collection<Entity> sideA, Collection<Entity> sideB, boolean isServer, DimensionType dimension) public Battle(BattleManager battleManager, int id, Collection<Entity> sideA, Collection<Entity> sideB, boolean isServer, RegistryKey<World> dimension)
{ {
this.battleManager = battleManager; this.battleManager = battleManager;
this.isServer = isServer; this.isServer = isServer;
@ -159,8 +161,8 @@ public class Battle
} }
if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled()) if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled())
{ {
newCombatant.x = e.posX; newCombatant.x = e.getPosX();
newCombatant.z = e.posZ; newCombatant.z = e.getPosZ();
newCombatant.yaw = e.rotationYaw; newCombatant.yaw = e.rotationYaw;
newCombatant.pitch = e.rotationPitch; newCombatant.pitch = e.rotationPitch;
} }
@ -197,8 +199,8 @@ public class Battle
} }
if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled()) if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled())
{ {
newCombatant.x = e.posX; newCombatant.x = e.getPosX();
newCombatant.z = e.posZ; newCombatant.z = e.getPosZ();
newCombatant.yaw = e.rotationYaw; newCombatant.yaw = e.rotationYaw;
newCombatant.pitch = e.rotationPitch; newCombatant.pitch = e.rotationPitch;
} }
@ -339,8 +341,8 @@ public class Battle
} }
if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled()) if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled())
{ {
newCombatant.x = e.posX; newCombatant.x = e.getPosX();
newCombatant.z = e.posZ; newCombatant.z = e.getPosZ();
newCombatant.yaw = e.rotationYaw; newCombatant.yaw = e.rotationYaw;
newCombatant.pitch = e.rotationPitch; newCombatant.pitch = e.rotationPitch;
} }
@ -402,8 +404,8 @@ public class Battle
} }
if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled()) if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled())
{ {
newCombatant.x = e.posX; newCombatant.x = e.getPosX();
newCombatant.z = e.posZ; newCombatant.z = e.getPosZ();
newCombatant.yaw = e.rotationYaw; newCombatant.yaw = e.rotationYaw;
newCombatant.pitch = e.rotationPitch; newCombatant.pitch = e.rotationPitch;
} }
@ -673,11 +675,11 @@ public class Battle
{ {
for(Combatant c : sideA.values()) for(Combatant c : sideA.values())
{ {
c.entity.setPositionAndRotation(c.x, c.entity.posY, c.z, c.yaw, c.pitch); c.entity.setPositionAndRotation(c.x, c.entity.getPosY(), c.z, c.yaw, c.pitch);
} }
for(Combatant c : sideB.values()) for(Combatant c : sideB.values())
{ {
c.entity.setPositionAndRotation(c.x, c.entity.posY, c.z, c.yaw, c.pitch); c.entity.setPositionAndRotation(c.x, c.entity.getPosY(), c.z, c.yaw, c.pitch);
} }
} }
@ -929,8 +931,8 @@ public class Battle
{ {
final Entity nextEntity = next.entity; final Entity nextEntity = next.entity;
final Entity targetEntity = target.entity; final Entity targetEntity = target.entity;
final float yawDirection = Utility.yawDirection(next.entity.posX, next.entity.posZ, target.entity.posX, target.entity.posZ); final float yawDirection = Utility.yawDirection(next.entity.getPosX(), next.entity.getPosZ(), target.entity.getPosX(), target.entity.getPosZ());
final float pitchDirection = Utility.pitchDirection(next.entity.posX, next.entity.posY, next.entity.posZ, target.entity.posX, target.entity.posY, target.entity.posZ); final float pitchDirection = Utility.pitchDirection(next.entity.getPosX(), next.entity.getPosY(), next.entity.getPosZ(), target.entity.getPosX(), target.entity.getPosY(), target.entity.getPosZ());
final int randomTimeLeft = random.nextInt(heldItemStack.getItem().getUseDuration(heldItemStack) / 3); final int randomTimeLeft = random.nextInt(heldItemStack.getItem().getUseDuration(heldItemStack) / 3);
if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled()) if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled())
{ {
@ -938,7 +940,7 @@ public class Battle
next.pitch = pitchDirection; next.pitch = pitchDirection;
} }
// have player look at attack target // have player look at attack target
((ServerPlayerEntity)nextEntity).connection.setPlayerLocation(nextEntity.posX, nextEntity.posY, nextEntity.posZ, yawDirection, pitchDirection); ((ServerPlayerEntity)nextEntity).connection.setPlayerLocation(nextEntity.getPosX(), nextEntity.getPosY(), nextEntity.getPosZ(), yawDirection, pitchDirection);
BowItem itemBow = (BowItem)heldItemStack.getItem(); BowItem itemBow = (BowItem)heldItemStack.getItem();
TurnBasedMinecraftMod.proxy.getAttackerViaBowSet().add(new AttackerViaBow(nextEntity, getId())); TurnBasedMinecraftMod.proxy.getAttackerViaBowSet().add(new AttackerViaBow(nextEntity, getId()));
itemBow.onPlayerStoppedUsing(((PlayerEntity)nextEntity).getHeldItemMainhand(), nextEntity.getEntityWorld(), (LivingEntity) nextEntity, randomTimeLeft); itemBow.onPlayerStoppedUsing(((PlayerEntity)nextEntity).getHeldItemMainhand(), nextEntity.getEntityWorld(), (LivingEntity) nextEntity, randomTimeLeft);
@ -973,8 +975,8 @@ public class Battle
final Entity nextEntity = next.entity; final Entity nextEntity = next.entity;
final Entity targetEntity = target.entity; final Entity targetEntity = target.entity;
final EntityInfo targetEntityInfo = target.entityInfo; final EntityInfo targetEntityInfo = target.entityInfo;
final float yawDirection = Utility.yawDirection(next.entity.posX, next.entity.posZ, target.entity.posX, target.entity.posZ); final float yawDirection = Utility.yawDirection(next.entity.getPosX(), next.entity.getPosZ(), target.entity.getPosX(), target.entity.getPosZ());
final float pitchDirection = Utility.pitchDirection(next.entity.posX, next.entity.posY, next.entity.posZ, target.entity.posX, target.entity.posY, target.entity.posZ); final float pitchDirection = Utility.pitchDirection(next.entity.getPosX(), next.entity.getPosY(), next.entity.getPosZ(), target.entity.getPosX(), target.entity.getPosY(), target.entity.getPosZ());
final boolean defenseDamageTriggered; final boolean defenseDamageTriggered;
if(!(targetEntity instanceof PlayerEntity) && targetEntityInfo.defenseDamage > 0 && targetEntityInfo.defenseDamageProbability > 0) if(!(targetEntity instanceof PlayerEntity) && targetEntityInfo.defenseDamage > 0 && targetEntityInfo.defenseDamageProbability > 0)
{ {
@ -997,7 +999,7 @@ public class Battle
next.pitch = pitchDirection; next.pitch = pitchDirection;
} }
// have player look at attack target // have player look at attack target
((ServerPlayerEntity)nextEntity).connection.setPlayerLocation(nextEntity.posX, nextEntity.posY, nextEntity.posZ, yawDirection, pitchDirection); ((ServerPlayerEntity)nextEntity).connection.setPlayerLocation(nextEntity.getPosX(), nextEntity.getPosY(), nextEntity.getPosZ(), yawDirection, pitchDirection);
TurnBasedMinecraftMod.proxy.setAttackingEntity(nextEntity); TurnBasedMinecraftMod.proxy.setAttackingEntity(nextEntity);
TurnBasedMinecraftMod.proxy.setAttackingDamage(0); TurnBasedMinecraftMod.proxy.setAttackingDamage(0);
((PlayerEntity)nextEntity).attackTargetEntityWithCurrentItem(targetEntity); ((PlayerEntity)nextEntity).attackTargetEntityWithCurrentItem(targetEntity);
@ -1294,7 +1296,7 @@ public class Battle
if(targetItem.getGroup() == ItemGroup.FOOD) if(targetItem.getGroup() == ItemGroup.FOOD)
{ {
debugLog += " food"; debugLog += " food";
sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getEntityId(), 0, PacketBattleMessage.UsedItemAction.USED_FOOD.getValue(), targetItemStack.getDisplayName().getFormattedText()); sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getEntityId(), 0, PacketBattleMessage.UsedItemAction.USED_FOOD.getValue(), targetItemStack.getDisplayName().getString());
final Entity nextEntity = next.entity; final Entity nextEntity = next.entity;
final int nextItemToUse = next.itemToUse; final int nextItemToUse = next.itemToUse;
((PlayerEntity)nextEntity).inventory.setInventorySlotContents(nextItemToUse, targetItem.onItemUseFinish(targetItemStack, nextEntity.world, (LivingEntity)nextEntity)); ((PlayerEntity)nextEntity).inventory.setInventorySlotContents(nextItemToUse, targetItem.onItemUseFinish(targetItemStack, nextEntity.world, (LivingEntity)nextEntity));
@ -1302,7 +1304,7 @@ public class Battle
else if(targetItem instanceof PotionItem) else if(targetItem instanceof PotionItem)
{ {
debugLog += " potion"; debugLog += " potion";
sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getEntityId(), 0, PacketBattleMessage.UsedItemAction.USED_POTION.getValue(), targetItemStack.getDisplayName().getFormattedText()); sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getEntityId(), 0, PacketBattleMessage.UsedItemAction.USED_POTION.getValue(), targetItemStack.getDisplayName().getString());
final Entity nextEntity = next.entity; final Entity nextEntity = next.entity;
final int nextItemToUse = next.itemToUse; final int nextItemToUse = next.itemToUse;
((PlayerEntity)nextEntity).inventory.setInventorySlotContents(nextItemToUse, targetItem.onItemUseFinish(targetItemStack, nextEntity.world, (LivingEntity)nextEntity)); ((PlayerEntity)nextEntity).inventory.setInventorySlotContents(nextItemToUse, targetItem.onItemUseFinish(targetItemStack, nextEntity.world, (LivingEntity)nextEntity));
@ -1310,7 +1312,7 @@ public class Battle
else else
{ {
debugLog += " non-consumable"; debugLog += " non-consumable";
sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getEntityId(), 0, PacketBattleMessage.UsedItemAction.USED_INVALID.getValue(), targetItemStack.getDisplayName().getFormattedText()); sendMessageToAllPlayers(PacketBattleMessage.MessageType.USED_ITEM, next.entity.getEntityId(), 0, PacketBattleMessage.UsedItemAction.USED_INVALID.getValue(), targetItemStack.getDisplayName().getString());
} }
break; break;
case SWITCH_ITEM: case SWITCH_ITEM:

View file

@ -8,7 +8,8 @@ import java.util.Map;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.world.dimension.DimensionType; import net.minecraft.util.RegistryKey;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.network.PacketDistributor; import net.minecraftforge.fml.network.PacketDistributor;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -141,7 +142,7 @@ public class BattleManager
Collection<Entity> sideB = new ArrayList<Entity>(1); Collection<Entity> sideB = new ArrayList<Entity>(1);
sideA.add(event.getEntity()); sideA.add(event.getEntity());
sideB.add(event.getSource().getTrueSource()); sideB.add(event.getSource().getTrueSource());
createBattle(sideA, sideB, event.getEntity().dimension); createBattle(sideA, sideB, event.getEntity().getEntityWorld().func_234923_W_());
logger.debug("Attack Not Canceled: new battle created"); logger.debug("Attack Not Canceled: new battle created");
} }
else else
@ -244,7 +245,7 @@ public class BattleManager
Collection<Entity> sideB = new ArrayList<Entity>(1); Collection<Entity> sideB = new ArrayList<Entity>(1);
sideA.add(event.getEntity()); sideA.add(event.getEntity());
sideB.add(event.getTarget()); sideB.add(event.getTarget());
createBattle(sideA, sideB, event.getEntity().dimension); createBattle(sideA, sideB, event.getEntity().getEntityWorld().func_234923_W_());
logger.debug("neither in battle, at least one is player, creating new battle"); logger.debug("neither in battle, at least one is player, creating new battle");
} }
} else { } else {
@ -273,7 +274,7 @@ public class BattleManager
} }
} }
private Battle createBattle(Collection<Entity> sideA, Collection<Entity> sideB, DimensionType dimension) private Battle createBattle(Collection<Entity> sideA, Collection<Entity> sideB, RegistryKey<World> dimension)
{ {
Battle newBattle = null; Battle newBattle = null;
while(battleMap.containsKey(IDCounter)) while(battleMap.containsKey(IDCounter))

View file

@ -3,8 +3,10 @@ package com.burnedkirby.TurnBasedMinecraft.common;
import java.util.*; import java.util.*;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.RegistryKey;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.DimensionType;
import net.minecraft.world.World;
import net.minecraftforge.fml.server.ServerLifecycleHooks; import net.minecraftforge.fml.server.ServerLifecycleHooks;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -160,7 +162,7 @@ public class CommonProxy
return editingPlayers.remove(id); return editingPlayers.remove(id);
} }
public Entity getEntity(int id, DimensionType dim) { public Entity getEntity(int id, RegistryKey<World> dim) {
return ServerLifecycleHooks.getCurrentServer().getWorld(dim).getEntityByID(id); return ServerLifecycleHooks.getCurrentServer().getWorld(dim).getEntityByID(id);
} }
} }

View file

@ -2,26 +2,26 @@ package com.burnedkirby.TurnBasedMinecraft.common;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.world.dimension.DimensionType; import net.minecraft.util.RegistryKey;
import net.minecraftforge.common.DimensionManager; import net.minecraft.world.World;
public class EntityIDDimPair { public class EntityIDDimPair {
public int id; public int id;
public DimensionType dim; public RegistryKey<World> dim;
EntityIDDimPair() { EntityIDDimPair() {
id = 0; id = 0;
dim = Minecraft.getInstance().world.dimension.getType(); dim = Minecraft.getInstance().world.func_234923_W_();
} }
EntityIDDimPair(int id, DimensionType dim) { EntityIDDimPair(int id, RegistryKey<World> dim) {
this.id = id; this.id = id;
this.dim = dim; this.dim = dim;
} }
EntityIDDimPair(Entity entity) { EntityIDDimPair(Entity entity) {
id = entity.getEntityId(); id = entity.getEntityId();
dim = entity.dimension; dim = entity.getEntityWorld().func_234923_W_();
} }
public Entity getEntity() { public Entity getEntity() {

View file

@ -35,7 +35,7 @@ public class TurnBasedMinecraftMod
{ {
public static final String MODID = "com_burnedkirby_turnbasedminecraft"; public static final String MODID = "com_burnedkirby_turnbasedminecraft";
public static final String NAME = "Turn Based Minecraft Mod"; public static final String NAME = "Turn Based Minecraft Mod";
public static final String VERSION = "1.9"; public static final String VERSION = "1.10";
public static final String CONFIG_FILENAME = "TBM_Config.toml"; public static final String CONFIG_FILENAME = "TBM_Config.toml";
public static final String DEFAULT_CONFIG_FILENAME = "TBM_Config_DEFAULT.toml"; public static final String DEFAULT_CONFIG_FILENAME = "TBM_Config_DEFAULT.toml";
public static final String CONFIG_DIRECTORY = "config/TurnBasedMinecraft/"; public static final String CONFIG_DIRECTORY = "config/TurnBasedMinecraft/";

View file

@ -3,8 +3,10 @@ package com.burnedkirby.TurnBasedMinecraft.common;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ArrowItem; import net.minecraft.item.ArrowItem;
import net.minecraft.world.dimension.DimensionType; import net.minecraft.util.RegistryKey;
import net.minecraftforge.fml.server.ServerLifecycleHooks; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;
public class Utility public class Utility
{ {
@ -49,6 +51,15 @@ public class Utility
public static double distanceBetweenEntities(Entity a, Entity b) public static double distanceBetweenEntities(Entity a, Entity b)
{ {
return Math.sqrt(Math.pow(a.posX - b.posX, 2.0) + Math.pow(a.posY - b.posY, 2.0) + Math.pow(a.posZ - b.posZ, 2.0)); return Math.sqrt(Math.pow(a.getPosX() - b.getPosX(), 2.0) + Math.pow(a.getPosY()- b.getPosY(), 2.0) + Math.pow(a.getPosZ()- b.getPosZ(), 2.0));
}
public static String serializeDimension(RegistryKey<World> dimObject) {
return dimObject.func_240901_a_().toString();
}
public static RegistryKey<World> deserializeDimension(String dimString) {
ResourceLocation dimRes = new ResourceLocation(dimString);
return RegistryKey.func_240903_a_(Registry.field_239699_ae_, dimRes);
} }
} }

View file

@ -9,8 +9,10 @@ import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod;
import com.burnedkirby.TurnBasedMinecraft.common.Utility; import com.burnedkirby.TurnBasedMinecraft.common.Utility;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.util.RegistryKey;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.DimensionType;
import net.minecraft.world.World;
import net.minecraftforge.fml.network.NetworkEvent; import net.minecraftforge.fml.network.NetworkEvent;
public class PacketBattleMessage public class PacketBattleMessage
@ -103,11 +105,11 @@ public class PacketBattleMessage
int entityIDTo; int entityIDTo;
int amount; int amount;
String custom; String custom;
DimensionType dimension; RegistryKey<World> dimension;
public PacketBattleMessage() { custom = new String(); } public PacketBattleMessage() { custom = new String(); }
public PacketBattleMessage(MessageType messageType, int entityIDFrom, int entityIDTo, DimensionType dimension, int amount) public PacketBattleMessage(MessageType messageType, int entityIDFrom, int entityIDTo, RegistryKey<World> dimension, int amount)
{ {
this.messageType = messageType; this.messageType = messageType;
this.entityIDFrom = entityIDFrom; this.entityIDFrom = entityIDFrom;
@ -117,7 +119,7 @@ public class PacketBattleMessage
custom = new String(); custom = new String();
} }
public PacketBattleMessage(MessageType messageType, int entityIDFrom, int entityIDTo, DimensionType dimension, int amount, String custom) public PacketBattleMessage(MessageType messageType, int entityIDFrom, int entityIDTo, RegistryKey<World> dimension, int amount, String custom)
{ {
this.messageType = messageType; this.messageType = messageType;
this.entityIDFrom = entityIDFrom; this.entityIDFrom = entityIDFrom;
@ -131,7 +133,7 @@ public class PacketBattleMessage
buf.writeInt(pkt.messageType.getValue()); buf.writeInt(pkt.messageType.getValue());
buf.writeInt(pkt.entityIDFrom); buf.writeInt(pkt.entityIDFrom);
buf.writeInt(pkt.entityIDTo); buf.writeInt(pkt.entityIDTo);
buf.writeString(DimensionType.getKey(pkt.dimension).toString()); buf.writeString(Utility.serializeDimension(pkt.dimension));
buf.writeInt(pkt.amount); buf.writeInt(pkt.amount);
buf.writeString(pkt.custom); buf.writeString(pkt.custom);
} }
@ -142,7 +144,7 @@ public class PacketBattleMessage
buf.readInt()), buf.readInt()),
buf.readInt(), buf.readInt(),
buf.readInt(), buf.readInt(),
DimensionType.byName(new ResourceLocation(buf.readString())), Utility.deserializeDimension(buf.readString()),
buf.readInt(), buf.readInt(),
buf.readString()); buf.readString());
} }
@ -154,28 +156,28 @@ public class PacketBattleMessage
String from = "Unknown"; String from = "Unknown";
if(fromEntity != null) if(fromEntity != null)
{ {
from = fromEntity.getDisplayName().getFormattedText(); from = fromEntity.getDisplayName().getString();
} }
else if(TurnBasedMinecraftMod.proxy.getLocalBattle() != null) else if(TurnBasedMinecraftMod.proxy.getLocalBattle() != null)
{ {
fromEntity = TurnBasedMinecraftMod.proxy.getLocalBattle().getCombatantEntity(pkt.entityIDFrom); fromEntity = TurnBasedMinecraftMod.proxy.getLocalBattle().getCombatantEntity(pkt.entityIDFrom);
if(fromEntity != null) if(fromEntity != null)
{ {
from = fromEntity.getDisplayName().getFormattedText(); from = fromEntity.getDisplayName().getString();
} }
} }
Entity toEntity = TurnBasedMinecraftMod.proxy.getEntity(pkt.entityIDTo, pkt.dimension); Entity toEntity = TurnBasedMinecraftMod.proxy.getEntity(pkt.entityIDTo, pkt.dimension);
String to = "Unknown"; String to = "Unknown";
if(toEntity != null) if(toEntity != null)
{ {
to = toEntity.getDisplayName().getFormattedText(); to = toEntity.getDisplayName().getString();
} }
else if(TurnBasedMinecraftMod.proxy.getLocalBattle() != null) else if(TurnBasedMinecraftMod.proxy.getLocalBattle() != null)
{ {
toEntity = TurnBasedMinecraftMod.proxy.getLocalBattle().getCombatantEntity(pkt.entityIDTo); toEntity = TurnBasedMinecraftMod.proxy.getLocalBattle().getCombatantEntity(pkt.entityIDTo);
if(toEntity != null) if(toEntity != null)
{ {
to = toEntity.getDisplayName().getFormattedText(); to = toEntity.getDisplayName().getString();
} }
} }

View file

@ -3,9 +3,9 @@ package com.burnedkirby.TurnBasedMinecraft.common.networking;
import com.burnedkirby.TurnBasedMinecraft.common.EntityInfo; import com.burnedkirby.TurnBasedMinecraft.common.EntityInfo;
import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod; import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.util.text.Color;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.event.ClickEvent; import net.minecraft.util.text.event.ClickEvent;
import net.minecraft.util.text.event.HoverEvent; import net.minecraft.util.text.event.HoverEvent;
import net.minecraftforge.fml.network.NetworkEvent; import net.minecraftforge.fml.network.NetworkEvent;
@ -129,7 +129,7 @@ public class PacketEditingMessage
einfo.customName = buf.readString(); einfo.customName = buf.readString();
return new PacketEditingMessage(type, einfo); return new PacketEditingMessage(type, einfo);
} }
public static class Handler { public static class Handler {
public static void handle(final PacketEditingMessage pkt, Supplier<NetworkEvent.Context> ctx) { public static void handle(final PacketEditingMessage pkt, Supplier<NetworkEvent.Context> ctx) {
ctx.get().enqueueWork(() -> { ctx.get().enqueueWork(() -> {
@ -137,572 +137,588 @@ public class PacketEditingMessage
{ {
case ATTACK_ENTITY: case ATTACK_ENTITY:
{ {
ITextComponent prefix = new StringTextComponent("TBM: "); StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true); prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
ITextComponent text = new StringTextComponent("Attack the entity you want to edit for TurnBasedMinecraftMod. "); StringTextComponent text = new StringTextComponent("Attack the entity you want to edit for TurnBasedMinecraftMod. ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false); text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
ITextComponent cancel = new StringTextComponent("Cancel"); StringTextComponent cancel = new StringTextComponent("Cancel");
cancel.getStyle().setColor(TextFormatting.RED).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit cancel")); cancel.func_230530_a_(cancel.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit cancel")));
text.appendSibling(cancel); text.getSiblings().add(cancel);
prefix.appendSibling(text); prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break; break;
} }
case PICK_EDIT: case PICK_EDIT:
{ {
ITextComponent prefix = new StringTextComponent("TBM: "); StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true); prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
ITextComponent text = new StringTextComponent("Edit what value? "); StringTextComponent text = new StringTextComponent("Edit what value? ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false); text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
ITextComponent option = new StringTextComponent("IgB"); StringTextComponent option = new StringTextComponent("IgB");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle")) // HoverEvent.Action.field_230550_a_ is probably SHOW_TEXT
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("IgnoreBattle"))); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle"))
ITextComponent value = new StringTextComponent("(" + pkt.entityInfo.ignoreBattle + ") "); .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("IgnoreBattle"))));
value.getStyle().setColor(TextFormatting.WHITE); StringTextComponent value = new StringTextComponent("(" + pkt.entityInfo.ignoreBattle + ") ");
option.appendSibling(value); value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
text.appendSibling(option); option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("AP"); option = new StringTextComponent("AP");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackPower")) option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackPower"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("AttackPower"))); .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("AttackPower"))));
value = new StringTextComponent("(" + pkt.entityInfo.attackPower + ") "); value = new StringTextComponent("(" + pkt.entityInfo.attackPower + ") ");
value.getStyle().setColor(TextFormatting.WHITE); value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.appendSibling(value); option.getSiblings().add(value);
text.appendSibling(option); text.getSiblings().add(option);
option = new StringTextComponent("APr"); option = new StringTextComponent("APr");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackProbability")) option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackProbability"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("AttackProbability"))); .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("AttackProbability"))));
value = new StringTextComponent("(" + pkt.entityInfo.attackProbability + "%) "); value = new StringTextComponent("(" + pkt.entityInfo.attackProbability + "%) ");
value.getStyle().setColor(TextFormatting.WHITE); value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.appendSibling(value); option.getSiblings().add(value);
text.appendSibling(option); text.getSiblings().add(option);
option = new StringTextComponent("AV"); option = new StringTextComponent("AV");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackVariance")) option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackVariance"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("AttackVariance"))); .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("AttackVariance"))));
value = new StringTextComponent("(" + pkt.entityInfo.attackVariance + ") "); value = new StringTextComponent("(" + pkt.entityInfo.attackVariance + ") ");
value.getStyle().setColor(TextFormatting.WHITE); value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.appendSibling(value); option.getSiblings().add(value);
text.appendSibling(option); text.getSiblings().add(option);
option = new StringTextComponent("AE"); option = new StringTextComponent("AE");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffect")) option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffect"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("AttackEffect"))); .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("AttackEffect"))));
value = new StringTextComponent("(" + pkt.entityInfo.attackEffect.toString() + ") "); value = new StringTextComponent("(" + pkt.entityInfo.attackEffect.toString() + ") ");
value.getStyle().setColor(TextFormatting.WHITE); value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.appendSibling(value); option.getSiblings().add(value);
text.appendSibling(option); text.getSiblings().add(option);
option = new StringTextComponent("AEPr"); option = new StringTextComponent("AEPr");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffectProbability")) option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffectProbability"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("AttackEffectProbability"))); .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("AttackEffectProbability"))));
value = new StringTextComponent("(" + pkt.entityInfo.attackEffectProbability + "%) "); value = new StringTextComponent("(" + pkt.entityInfo.attackEffectProbability + "%) ");
value.getStyle().setColor(TextFormatting.WHITE); value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.appendSibling(value); option.getSiblings().add(value);
text.appendSibling(option); text.getSiblings().add(option);
option = new StringTextComponent("DD"); option = new StringTextComponent("DD");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamage")) option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamage"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("DefenseDamage"))); .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("DefenseDamage"))));
value = new StringTextComponent("(" + pkt.entityInfo.defenseDamage + ") "); value = new StringTextComponent("(" + pkt.entityInfo.defenseDamage + ") ");
value.getStyle().setColor(TextFormatting.WHITE); value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.appendSibling(value); option.getSiblings().add(value);
text.appendSibling(option); text.getSiblings().add(option);
option = new StringTextComponent("DDPr"); option = new StringTextComponent("DDPr");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamageProbability")) option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamageProbability"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("DefenseDamageProbability"))); .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("DefenseDamageProbability"))));
value = new StringTextComponent("(" + pkt.entityInfo.defenseDamageProbability + "%) "); value = new StringTextComponent("(" + pkt.entityInfo.defenseDamageProbability + "%) ");
value.getStyle().setColor(TextFormatting.WHITE); value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.appendSibling(value); option.getSiblings().add(value);
text.appendSibling(option); text.getSiblings().add(option);
option = new StringTextComponent("E"); option = new StringTextComponent("E");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit evasion")) option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit evasion"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("Evasion"))); .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("Evasion"))));
value = new StringTextComponent("(" + pkt.entityInfo.evasion + "%) "); value = new StringTextComponent("(" + pkt.entityInfo.evasion + "%) ");
value.getStyle().setColor(TextFormatting.WHITE); value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.appendSibling(value); option.getSiblings().add(value);
text.appendSibling(option); text.getSiblings().add(option);
option = new StringTextComponent("S"); option = new StringTextComponent("S");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit speed")) option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit speed"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("Speed"))); .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("Speed"))));
value = new StringTextComponent("(" + pkt.entityInfo.speed + ") "); value = new StringTextComponent("(" + pkt.entityInfo.speed + ") ");
value.getStyle().setColor(TextFormatting.WHITE); value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.appendSibling(value); option.getSiblings().add(value);
text.appendSibling(option); text.getSiblings().add(option);
option = new StringTextComponent("C"); option = new StringTextComponent("C");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category")) option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("Category"))); .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("Category"))));
value = new StringTextComponent("(" + pkt.entityInfo.category + ") "); value = new StringTextComponent("(" + pkt.entityInfo.category + ") ");
value.getStyle().setColor(TextFormatting.WHITE); value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.appendSibling(value); option.getSiblings().add(value);
text.appendSibling(option); text.getSiblings().add(option);
option = new StringTextComponent("DecA"); option = new StringTextComponent("DecA");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionAttack")) option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionAttack"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("DecisionAttack"))); .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("DecisionAttack"))));
value = new StringTextComponent("(" + pkt.entityInfo.decisionAttack + "%) "); value = new StringTextComponent("(" + pkt.entityInfo.decisionAttack + "%) ");
value.getStyle().setColor(TextFormatting.WHITE); value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.appendSibling(value); option.getSiblings().add(value);
text.appendSibling(option); text.getSiblings().add(option);
option = new StringTextComponent("DecD"); option = new StringTextComponent("DecD");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionDefend")) option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionDefend"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("DecisionDefend"))); .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("DecisionDefend"))));
value = new StringTextComponent("(" + pkt.entityInfo.decisionDefend + "%) "); value = new StringTextComponent("(" + pkt.entityInfo.decisionDefend + "%) ");
value.getStyle().setColor(TextFormatting.WHITE); value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.appendSibling(value); option.getSiblings().add(value);
text.appendSibling(option); text.getSiblings().add(option);
option = new StringTextComponent("DecF"); option = new StringTextComponent("DecF");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionFlee")) option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionFlee"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("DecisionFlee"))); .func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("DecisionFlee"))));
value = new StringTextComponent("(" + pkt.entityInfo.decisionFlee + "%) "); value = new StringTextComponent("(" + pkt.entityInfo.decisionFlee + "%) ");
value.getStyle().setColor(TextFormatting.WHITE); value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.appendSibling(value); option.getSiblings().add(value);
text.appendSibling(option); text.getSiblings().add(option);
option = new StringTextComponent("Finished Editing"); option = new StringTextComponent("Finished Editing");
option.getStyle().setColor(TextFormatting.GREEN).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit finish")); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit finish")));
text.appendSibling(option).appendText(" "); text.getSiblings().add(option);
text.getSiblings().add(new StringTextComponent(" "));
option = new StringTextComponent("Cancel"); option = new StringTextComponent("Cancel");
option.getStyle().setColor(TextFormatting.RED).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit cancel")); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit cancel")));
text.appendSibling(option); text.getSiblings().add(option);
prefix.appendSibling(text); prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break; break;
} }
case EDIT_IGNORE_BATTLE: case EDIT_IGNORE_BATTLE:
{ {
ITextComponent prefix = new StringTextComponent("TBM: "); StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true); prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
ITextComponent text = new StringTextComponent("ignoreBattle: "); StringTextComponent text = new StringTextComponent("ignoreBattle: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false); text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
ITextComponent option = new StringTextComponent("true"); StringTextComponent option = new StringTextComponent("true");
option.getStyle().setColor(TextFormatting.GREEN).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle true")); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle true")));
text.appendSibling(option); text.getSiblings().add(option);
text.appendText(" "); text.getSiblings().add(new StringTextComponent(" "));
option = new StringTextComponent("false"); option = new StringTextComponent("false");
option.getStyle().setColor(TextFormatting.RED).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle false")); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle false")));
text.appendSibling(option); text.getSiblings().add(option);
prefix.appendSibling(text); prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break; break;
} }
case EDIT_ATTACK_POWER: case EDIT_ATTACK_POWER:
{ {
ITextComponent prefix = new StringTextComponent("TBM: "); StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true); prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
ITextComponent text = new StringTextComponent("attackPower: "); StringTextComponent text = new StringTextComponent("attackPower: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false); text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
for(int i = 0; i <= 15; ++i) for(int i = 0; i <= 15; ++i)
{ {
ITextComponent option = new StringTextComponent(Integer.toString(i)); StringTextComponent option = new StringTextComponent(Integer.toString(i));
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackPower " + Integer.toString(i))); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackPower " + Integer.toString(i))));
text.appendSibling(option); text.getSiblings().add(option);
if(i < 15) if(i < 15)
{ {
text.appendText(", "); text.getSiblings().add(new StringTextComponent(", "));
} }
} }
text.appendText(" (or use command \"/tbm-edit edit attackPower <integer>\")"); text.getSiblings().add(new StringTextComponent(" (or use command \"/tbm-edit edit attackPower <integer>\")"));
prefix.appendSibling(text); prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break; break;
} }
case EDIT_ATTACK_PROBABILITY: case EDIT_ATTACK_PROBABILITY:
{ {
ITextComponent prefix = new StringTextComponent("TBM: "); StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true); prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
ITextComponent text = new StringTextComponent("attackProbability: "); StringTextComponent text = new StringTextComponent("attackProbability: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false); text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
for(int i = 10; i <= 100; i += 10) for(int i = 10; i <= 100; i += 10)
{ {
ITextComponent option = new StringTextComponent(Integer.toString(i) + "%"); StringTextComponent option = new StringTextComponent(Integer.toString(i) + "%");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackProbability " + Integer.toString(i))); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackProbability " + Integer.toString(i))));
text.appendSibling(option); text.getSiblings().add(option);
if(i < 100) if(i < 100)
{ {
text.appendText(", "); text.getSiblings().add(new StringTextComponent(", "));
} }
} }
text.appendText(" (or use command \"/tbm-edit edit attackProbability <percentage-integer>\")"); text.getSiblings().add(new StringTextComponent(" (or use command \"/tbm-edit edit attackProbability <percentage-integer>\")"));
prefix.appendSibling(text); prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break; break;
} }
case EDIT_ATTACK_VARIANCE: case EDIT_ATTACK_VARIANCE:
{ {
ITextComponent prefix = new StringTextComponent("TBM: "); StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true); prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
ITextComponent text = new StringTextComponent("attackVariance: "); StringTextComponent text = new StringTextComponent("attackVariance: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false); text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
for(int i = 0; i <= 10; ++i) for(int i = 0; i <= 10; ++i)
{ {
ITextComponent option = new StringTextComponent(Integer.toString(i)); StringTextComponent option = new StringTextComponent(Integer.toString(i));
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackVariance " + Integer.toString(i))); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackVariance " + Integer.toString(i))));
text.appendSibling(option); text.getSiblings().add(option);
if(i < 10) if(i < 10)
{ {
text.appendText(", "); text.getSiblings().add(new StringTextComponent(", "));
} }
} }
text.appendText(" (or use command \"/tbm-edit edit attackVariance <integer>\")"); text.getSiblings().add(new StringTextComponent(" (or use command \"/tbm-edit edit attackVariance <integer>\")"));
prefix.appendSibling(text); prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break; break;
} }
case EDIT_ATTACK_EFFECT: case EDIT_ATTACK_EFFECT:
{ {
ITextComponent prefix = new StringTextComponent("TBM: "); StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true); prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
ITextComponent text = new StringTextComponent("attackEffect: "); StringTextComponent text = new StringTextComponent("attackEffect: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false); text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
for(EntityInfo.Effect e : EntityInfo.Effect.values()) for(EntityInfo.Effect e : EntityInfo.Effect.values())
{ {
ITextComponent option = new StringTextComponent(e.toString()); StringTextComponent option = new StringTextComponent(e.toString());
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffect " + e.toString())); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffect " + e.toString())));
text.appendSibling(option); text.getSiblings().add(option);
if(e != EntityInfo.Effect.UNKNOWN) if(e != EntityInfo.Effect.UNKNOWN)
{ {
// TODO find a better way to handle printing comma for items before last // TODO find a better way to handle printing comma for items before last
text.appendText(", "); text.getSiblings().add(new StringTextComponent(", "));
} }
} }
prefix.appendSibling(text); prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break; break;
} }
case EDIT_ATTACK_EFFECT_PROBABILITY: case EDIT_ATTACK_EFFECT_PROBABILITY:
{ {
ITextComponent prefix = new StringTextComponent("TBM: "); StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true); prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
ITextComponent text = new StringTextComponent("attackEffectProbability: "); StringTextComponent text = new StringTextComponent("attackEffectProbability: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false); text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
for(int i = 0; i <= 100; i += 10) for(int i = 0; i <= 100; i += 10)
{ {
ITextComponent option = new StringTextComponent(Integer.toString(i) + "%"); StringTextComponent option = new StringTextComponent(Integer.toString(i) + "%");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffectProbability " + Integer.toString(i))); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffectProbability " + Integer.toString(i))));
text.appendSibling(option); text.getSiblings().add(option);
if(i < 100) if(i < 100)
{ {
text.appendText(", "); text.getSiblings().add(new StringTextComponent(", "));
} }
} }
text.appendText(" (or use command \"/tbm-edit edit attackEffectProbability <percentage-integer>\")"); text.getSiblings().add(new StringTextComponent(" (or use command \"/tbm-edit edit attackEffectProbability <percentage-integer>\")"));
prefix.appendSibling(text); prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break; break;
} }
case EDIT_DEFENSE_DAMAGE: case EDIT_DEFENSE_DAMAGE:
{ {
ITextComponent prefix = new StringTextComponent("TBM: "); StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true); prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
ITextComponent text = new StringTextComponent("defenseDamage: "); StringTextComponent text = new StringTextComponent("defenseDamage: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false); text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
for(int i = 0; i <= 15; ++i) for(int i = 0; i <= 15; ++i)
{ {
ITextComponent option = new StringTextComponent(Integer.toString(i)); StringTextComponent option = new StringTextComponent(Integer.toString(i));
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamage " + Integer.toString(i))); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamage " + Integer.toString(i))));
text.appendSibling(option); text.getSiblings().add(option);
if(i < 15) if(i < 15)
{ {
text.appendText(", "); text.getSiblings().add(new StringTextComponent(", "));
} }
} }
text.appendText(" (or use command \"/tbm-edit edit defenseDamage <integer>\")"); text.getSiblings().add(new StringTextComponent(" (or use command \"/tbm-edit edit defenseDamage <integer>\")"));
prefix.appendSibling(text); prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break; break;
} }
case EDIT_DEFENSE_DAMAGE_PROBABILITY: case EDIT_DEFENSE_DAMAGE_PROBABILITY:
{ {
ITextComponent prefix = new StringTextComponent("TBM: "); StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true); prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
ITextComponent text = new StringTextComponent("defenseDamageProbability: "); StringTextComponent text = new StringTextComponent("defenseDamageProbability: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false); text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
for(int i = 0; i <= 100; i += 10) for(int i = 0; i <= 100; i += 10)
{ {
ITextComponent option = new StringTextComponent(Integer.toString(i) + "%"); StringTextComponent option = new StringTextComponent(Integer.toString(i) + "%");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamageProbability " + Integer.toString(i))); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamageProbability " + Integer.toString(i))));
text.appendSibling(option); text.getSiblings().add(option);
if(i < 100) if(i < 100)
{ {
text.appendText(", "); text.getSiblings().add(new StringTextComponent(", "));
} }
} }
text.appendText(" (or use command \"/tbm-edit edit defenseDamageProbability <percentage-integer>\")"); text.getSiblings().add(new StringTextComponent(" (or use command \"/tbm-edit edit defenseDamageProbability <percentage-integer>\")"));
prefix.appendSibling(text); prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break; break;
} }
case EDIT_EVASION: case EDIT_EVASION:
{ {
ITextComponent prefix = new StringTextComponent("TBM: "); StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true); prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
ITextComponent text = new StringTextComponent("evasion: "); StringTextComponent text = new StringTextComponent("evasion: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false); text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
for(int i = 0; i <= 100; i += 10) for(int i = 0; i <= 100; i += 10)
{ {
ITextComponent option = new StringTextComponent(Integer.toString(i) + "%"); StringTextComponent option = new StringTextComponent(Integer.toString(i) + "%");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit evasion " + Integer.toString(i))); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit evasion " + Integer.toString(i))));
text.appendSibling(option); text.getSiblings().add(option);
if(i < 100) if(i < 100)
{ {
text.appendText(", "); text.getSiblings().add(new StringTextComponent(", "));
} }
} }
text.appendText(" (or use command \"/tbm-edit edit evasion <percentage-integer>\")"); text.getSiblings().add(new StringTextComponent(" (or use command \"/tbm-edit edit evasion <percentage-integer>\")"));
prefix.appendSibling(text); prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break; break;
} }
case EDIT_SPEED: case EDIT_SPEED:
{ {
ITextComponent prefix = new StringTextComponent("TBM: "); StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true); prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
ITextComponent text = new StringTextComponent("speed: "); StringTextComponent text = new StringTextComponent("speed: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false); text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
for(int i = 0; i <= 100; i += 10) for(int i = 0; i <= 100; i += 10)
{ {
ITextComponent option = new StringTextComponent(Integer.toString(i)); StringTextComponent option = new StringTextComponent(Integer.toString(i));
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit speed " + Integer.toString(i))); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit speed " + Integer.toString(i))));
text.appendSibling(option); text.getSiblings().add(option);
if(i < 100) if(i < 100)
{ {
text.appendText(", "); text.getSiblings().add(new StringTextComponent(", "));
} }
} }
text.appendText(" (or use command \"/tbm-edit edit speed <integer>\")"); text.getSiblings().add(new StringTextComponent(" (or use command \"/tbm-edit edit speed <integer>\")"));
prefix.appendSibling(text); prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break; break;
} }
case EDIT_CATEGORY: case EDIT_CATEGORY:
{ {
ITextComponent prefix = new StringTextComponent("TBM: "); StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true); prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
ITextComponent text = new StringTextComponent("category: "); StringTextComponent text = new StringTextComponent("category: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false); text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
ITextComponent option = new StringTextComponent("monster"); StringTextComponent option = new StringTextComponent("monster");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category monster")); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category monster")));
if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("monster")) if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("monster"))
{ {
ITextComponent optionInfo = new StringTextComponent("(battle-"); StringTextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.getStyle().setColor(TextFormatting.WHITE); optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
ITextComponent optionInfoBool = new StringTextComponent("disabled"); StringTextComponent optionInfoBool = new StringTextComponent("disabled");
optionInfoBool.getStyle().setColor(TextFormatting.RED); optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)));
optionInfo.appendSibling(optionInfoBool).appendText(")"); optionInfo.getSiblings().add(optionInfoBool);
option.appendSibling(optionInfo); optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
} }
else else
{ {
ITextComponent optionInfo = new StringTextComponent("(battle-"); StringTextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.getStyle().setColor(TextFormatting.WHITE); optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
ITextComponent optionInfoBool = new StringTextComponent("enabled"); StringTextComponent optionInfoBool = new StringTextComponent("enabled");
optionInfoBool.getStyle().setColor(TextFormatting.GREEN); optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)));
optionInfo.appendSibling(optionInfoBool).appendText(")"); optionInfo.getSiblings().add(optionInfoBool);
option.appendSibling(optionInfo); optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
} }
text.appendSibling(option).appendText(", "); text.getSiblings().add(option);
text.getSiblings().add(new StringTextComponent(", "));
option = new StringTextComponent("animal"); option = new StringTextComponent("animal");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category animal")); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category animal")));
if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("animal")) if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("animal"))
{ {
ITextComponent optionInfo = new StringTextComponent("(battle-"); StringTextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.getStyle().setColor(TextFormatting.WHITE); optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
ITextComponent optionInfoBool = new StringTextComponent("disabled"); StringTextComponent optionInfoBool = new StringTextComponent("disabled");
optionInfoBool.getStyle().setColor(TextFormatting.RED); optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)));
optionInfo.appendSibling(optionInfoBool).appendText(")"); optionInfo.getSiblings().add(optionInfoBool);
option.appendSibling(optionInfo); optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
} }
else else
{ {
ITextComponent optionInfo = new StringTextComponent("(battle-"); StringTextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.getStyle().setColor(TextFormatting.WHITE); optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
ITextComponent optionInfoBool = new StringTextComponent("enabled"); StringTextComponent optionInfoBool = new StringTextComponent("enabled");
optionInfoBool.getStyle().setColor(TextFormatting.GREEN); optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)));
optionInfo.appendSibling(optionInfoBool).appendText(")"); optionInfo.getSiblings().add(optionInfoBool);
option.appendSibling(optionInfo); optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
} }
text.appendSibling(option).appendText(", "); text.getSiblings().add(option);
text.getSiblings().add(new StringTextComponent(", "));
option = new StringTextComponent("passive"); option = new StringTextComponent("passive");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category passive")); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category passive")));
if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("passive")) if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("passive"))
{ {
ITextComponent optionInfo = new StringTextComponent("(battle-"); StringTextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.getStyle().setColor(TextFormatting.WHITE); optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
ITextComponent optionInfoBool = new StringTextComponent("disabled"); StringTextComponent optionInfoBool = new StringTextComponent("disabled");
optionInfoBool.getStyle().setColor(TextFormatting.RED); optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)));
optionInfo.appendSibling(optionInfoBool).appendText(")"); optionInfo.getSiblings().add(optionInfoBool);
option.appendSibling(optionInfo); optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
} }
else else
{ {
ITextComponent optionInfo = new StringTextComponent("(battle-"); StringTextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.getStyle().setColor(TextFormatting.WHITE); optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
ITextComponent optionInfoBool = new StringTextComponent("enabled"); StringTextComponent optionInfoBool = new StringTextComponent("enabled");
optionInfoBool.getStyle().setColor(TextFormatting.GREEN); optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)));
optionInfo.appendSibling(optionInfoBool).appendText(")"); optionInfo.getSiblings().add(optionInfoBool);
option.appendSibling(optionInfo); optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
} }
text.appendSibling(option).appendText(", "); text.getSiblings().add(option);
text.getSiblings().add(new StringTextComponent(", "));
option = new StringTextComponent("boss"); option = new StringTextComponent("boss");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category boss")); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category boss")));
if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("boss")) if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("boss"))
{ {
ITextComponent optionInfo = new StringTextComponent("(battle-"); StringTextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.getStyle().setColor(TextFormatting.WHITE); optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
ITextComponent optionInfoBool = new StringTextComponent("disabled"); StringTextComponent optionInfoBool = new StringTextComponent("disabled");
optionInfoBool.getStyle().setColor(TextFormatting.RED); optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)));
optionInfo.appendSibling(optionInfoBool).appendText(")"); optionInfo.getSiblings().add(optionInfoBool);
option.appendSibling(optionInfo); optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
} }
else else
{ {
ITextComponent optionInfo = new StringTextComponent("(battle-"); StringTextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.getStyle().setColor(TextFormatting.WHITE); optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
ITextComponent optionInfoBool = new StringTextComponent("enabled"); StringTextComponent optionInfoBool = new StringTextComponent("enabled");
optionInfoBool.getStyle().setColor(TextFormatting.GREEN); optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)));
optionInfo.appendSibling(optionInfoBool).appendText(")"); optionInfo.getSiblings().add(optionInfoBool);
option.appendSibling(optionInfo); optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
} }
text.appendSibling(option).appendText(", "); text.getSiblings().add(option);
text.getSiblings().add(new StringTextComponent(", "));
option = new StringTextComponent("player"); option = new StringTextComponent("player");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category player")); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category player")));
if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("player")) if(TurnBasedMinecraftMod.proxy.getConfig().isIgnoreBattleType("player"))
{ {
ITextComponent optionInfo = new StringTextComponent("(battle-"); StringTextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.getStyle().setColor(TextFormatting.WHITE); optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
ITextComponent optionInfoBool = new StringTextComponent("disabled"); StringTextComponent optionInfoBool = new StringTextComponent("disabled");
optionInfoBool.getStyle().setColor(TextFormatting.RED); optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)));
optionInfo.appendSibling(optionInfoBool).appendText(")"); optionInfo.getSiblings().add(optionInfoBool);
option.appendSibling(optionInfo); optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
} }
else else
{ {
ITextComponent optionInfo = new StringTextComponent("(battle-"); StringTextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.getStyle().setColor(TextFormatting.WHITE); optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
ITextComponent optionInfoBool = new StringTextComponent("enabled"); StringTextComponent optionInfoBool = new StringTextComponent("enabled");
optionInfoBool.getStyle().setColor(TextFormatting.GREEN); optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)));
optionInfo.appendSibling(optionInfoBool).appendText(")"); optionInfo.getSiblings().add(optionInfoBool);
option.appendSibling(optionInfo); optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
} }
text.appendSibling(option); text.getSiblings().add(option);
text.appendText(" (or use command \"/tbm-edit edit category <string>\")"); text.getSiblings().add(new StringTextComponent(" (or use command \"/tbm-edit edit category <string>\")"));
prefix.appendSibling(text); prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break; break;
} }
case EDIT_DECISION_ATTACK: case EDIT_DECISION_ATTACK:
{ {
ITextComponent prefix = new StringTextComponent("TBM: "); StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true); prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
ITextComponent text = new StringTextComponent("decisionAttack: "); StringTextComponent text = new StringTextComponent("decisionAttack: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false); text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
for(int i = 0; i <= 100; i += 10) for(int i = 0; i <= 100; i += 10)
{ {
ITextComponent option = new StringTextComponent(Integer.toString(i) + "%"); StringTextComponent option = new StringTextComponent(Integer.toString(i) + "%");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionAttack " + Integer.toString(i))); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionAttack " + Integer.toString(i))));
text.appendSibling(option); text.getSiblings().add(option);
if(i < 100) if(i < 100)
{ {
text.appendText(", "); text.getSiblings().add(new StringTextComponent(", "));
} }
} }
prefix.appendSibling(text); prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break; break;
} }
case EDIT_DECISION_DEFEND: case EDIT_DECISION_DEFEND:
{ {
ITextComponent prefix = new StringTextComponent("TBM: "); StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true); prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
ITextComponent text = new StringTextComponent("decisionDefend: "); StringTextComponent text = new StringTextComponent("decisionDefend: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false); text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
for(int i = 0; i <= 100; i += 10) for(int i = 0; i <= 100; i += 10)
{ {
ITextComponent option = new StringTextComponent(Integer.toString(i) + "%"); StringTextComponent option = new StringTextComponent(Integer.toString(i) + "%");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionDefend " + Integer.toString(i))); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionDefend " + Integer.toString(i))));
text.appendSibling(option); text.getSiblings().add(option);
if(i < 100) if(i < 100)
{ {
text.appendText(", "); text.getSiblings().add(new StringTextComponent(", "));
} }
} }
prefix.appendSibling(text); prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break; break;
} }
case EDIT_DECISION_FLEE: case EDIT_DECISION_FLEE:
{ {
ITextComponent prefix = new StringTextComponent("TBM: "); StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true); prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
ITextComponent text = new StringTextComponent("decisionFlee: "); StringTextComponent text = new StringTextComponent("decisionFlee: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false); text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
for(int i = 0; i <= 100; i += 10) for(int i = 0; i <= 100; i += 10)
{ {
ITextComponent option = new StringTextComponent(Integer.toString(i) + "%"); StringTextComponent option = new StringTextComponent(Integer.toString(i) + "%");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionFlee " + Integer.toString(i))); option.func_230530_a_(option.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFF00)).func_240715_a_(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionFlee " + Integer.toString(i))));
text.appendSibling(option); text.getSiblings().add(option);
if(i < 100) if(i < 100)
{ {
text.appendText(", "); text.getSiblings().add(new StringTextComponent(", "));
} }
} }
prefix.appendSibling(text); prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix); TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break; break;
} }

View file

@ -6,15 +6,16 @@
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version # A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[28,)" #mandatory (28 is current forge version) loaderVersion="[34,)" #mandatory (34 is current forge version)
# A URL to refer people to when problems occur with this mod # A URL to refer people to when problems occur with this mod
issueTrackerURL="https://github.com/Stephen-Seo/TurnBasedMinecraftMod/issues" #optional issueTrackerURL="https://github.com/Stephen-Seo/TurnBasedMinecraftMod/issues" #optional
license="MIT"
# A list of mods - how many allowed here is determined by the individual mod loader # A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory [[mods]] #mandatory
# The modid of the mod # The modid of the mod
modId="com_burnedkirby_turnbasedminecraft" #mandatory modId="com_burnedkirby_turnbasedminecraft" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
version="1.9" #mandatory version="1.10" #mandatory
# A display name for the mod # A display name for the mod
displayName="TurnBasedMinecraftMod" #mandatory displayName="TurnBasedMinecraftMod" #mandatory
# A URL to query for updates for this mod. See the JSON update specification <here> # A URL to query for updates for this mod. See the JSON update specification <here>
@ -38,7 +39,7 @@ Implements turn-based-battle in Minecraft.
# Does this dependency have to exist - if not, ordering below must be specified # Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory mandatory=true #mandatory
# The version range of the dependency # The version range of the dependency
versionRange="[28,)" #mandatory versionRange="[34,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE" ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER # Side this dependency is applied on - BOTH, CLIENT or SERVER
@ -47,6 +48,6 @@ Implements turn-based-battle in Minecraft.
[[dependencies.com_burnedkirby_turnbasedminecraft]] [[dependencies.com_burnedkirby_turnbasedminecraft]]
modId="minecraft" modId="minecraft"
mandatory=true mandatory=true
versionRange="[1.14.4]" versionRange="[1.16.3,)"
ordering="NONE" ordering="NONE"
side="BOTH" side="BOTH"