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
eclipse
run
logs/

View file

@ -1,5 +1,13 @@
# 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
Updated mod for 1.14.4

View file

@ -14,7 +14,7 @@ apply plugin: 'eclipse'
//apply plugin: 'maven-publish'
apply plugin: 'com.github.johnrengelman.shadow'
version = "1.9"
version = "1.10"
group = "com.burnedkirby.TurnBasedMinecraft"
archivesBaseName = "TurnBasedMinecraft"
@ -26,7 +26,7 @@ minecraft {
// stable_# Stables are built at the discretion of the MCP team.
// 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.
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.
// 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
// 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.
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..
// 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.networking.PacketBattleDecision;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen;
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;
public class BattleGui extends Screen {
@ -23,6 +27,7 @@ public class BattleGui extends Screen {
private MenuState state;
private boolean stateChanged;
private String info;
private Matrix4f identity;
private enum MenuState {
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;
state = MenuState.MAIN_MENU;
stateChanged = true;
identity = new Matrix4f();
identity.setIdentity();
}
private void setState(MenuState state) {
@ -119,21 +126,26 @@ public class BattleGui extends Screen {
}
stateChanged = false;
buttons.clear();
children.clear();
// field_230705_e_ is probably a list of buttons
field_230705_e_.clear();
// field_230710_m_ is probably a list of gui elements
field_230710_m_.clear();
switch (state) {
case MAIN_MENU:
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);
}));
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);
}));
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);
}));
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);
}));
break;
@ -144,11 +156,11 @@ public class BattleGui extends Screen {
for (Map.Entry<Integer, Combatant> e : TurnBasedMinecraftMod.proxy.getLocalBattle()
.getSideAEntrySet()) {
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);
}));
} 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);
}));
}
@ -162,11 +174,11 @@ public class BattleGui extends Screen {
for (Map.Entry<Integer, Combatant> e : TurnBasedMinecraftMod.proxy.getLocalBattle()
.getSideBEntrySet()) {
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);
}));
} 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);
}));
}
@ -175,19 +187,19 @@ public class BattleGui extends Screen {
} catch (ConcurrentModificationException e) {
// 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);
}));
break;
case ITEM_ACTION:
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);
}));
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);
}));
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);
}));
break;
@ -197,22 +209,22 @@ public class BattleGui extends Screen {
case SWITCH_ITEM:
info = "To which item will you switch to?";
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);
}));
}
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);
}));
break;
case USE_ITEM:
info = "Which item will you use?";
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);
}));
}
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);
}));
break;
@ -220,10 +232,10 @@ public class BattleGui extends Screen {
}
@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) {
// drawHoveringText("Waiting...", width / 2 - 50, height / 2);
getMinecraft().fontRenderer.drawString("Waiting...", width / 2 - 50, height / 2, 0xFFFFFFFF);
// drawHoveringText("Waiting...", field_230708_k_ / 2 - 50, field_230709_l_ / 2);
drawString("Waiting...", field_230708_k_ / 2 - 50, field_230709_l_ / 2, 0xFFFFFFFF);
return;
}
if (TurnBasedMinecraftMod.proxy.getLocalBattle().getState() == Battle.State.DECISION
@ -239,7 +251,7 @@ public class BattleGui extends Screen {
updateState();
super.render(mouseX, mouseY, partialTicks);
super.func_230430_a_(matrixStack, mouseX, mouseY, partialTicks);
String timeRemainingString = "Time remaining: ";
int timeRemainingInt = timeRemaining.get();
@ -251,12 +263,13 @@ public class BattleGui extends Screen {
timeRemainingString += "\u00A7c";
}
timeRemainingString += Integer.toString(timeRemainingInt);
int stringWidth = getMinecraft().fontRenderer.getStringWidth(timeRemainingString);
fill(width / 2 - stringWidth / 2, 5, width / 2 + stringWidth / 2, 15, 0x70000000);
getMinecraft().fontRenderer.drawString(timeRemainingString, width / 2 - stringWidth / 2, 5, 0xFFFFFFFF);
stringWidth = getMinecraft().fontRenderer.getStringWidth(info);
fill(width / 2 - stringWidth / 2, 20, width / 2 + stringWidth / 2, 30, 0x70000000);
getMinecraft().fontRenderer.drawString(info, width / 2 - stringWidth / 2, 20, 0xFFFFFFFF);
int stringWidth = field_230712_o_.getStringWidth(timeRemainingString);
// func_238467_a_ is probably fill
func_238467_a_(matrixStack, field_230708_k_ / 2 - stringWidth / 2, 5, field_230708_k_ / 2 + stringWidth / 2, 15, 0x70000000);
drawString(timeRemainingString, field_230708_k_ / 2 - stringWidth / 2, 5, 0xFFFFFFFF);
stringWidth = field_230712_o_.getStringWidth(info);
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) {
@ -322,19 +335,21 @@ public class BattleGui extends Screen {
}
}
@Override
protected void init() {
}
// @Override
// protected void init() {
// }
// func_231177_au__ is probably isPauseScreen
@Override
public boolean isPauseScreen() {
public boolean func_231177_au__() {
return false;
}
// func_231046_a_ is probably keyPressed
@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()) {
return super.keyPressed(a, b, c);
return super.func_231046_a_(a, b, c);
}
return false; // TODO verify return value
}
@ -342,4 +357,10 @@ public class BattleGui extends Screen {
public void setTimeRemaining(int 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 nextSilly;
private Sequencer sequencer;
private AudioInputStream wavInputStream;
private Clip clip;
private boolean playingIsSilly;
private boolean isPlaying;
@ -45,15 +46,17 @@ public class BattleMusic
sequencer.open();
} catch (Throwable t) {
logger.error("Failed to load midi sequencer");
t.printStackTrace();
sequencer = null;
}
try {
clip = AudioSystem.getClip();
} catch(Throwable t) {
logger.error("Failed to load clip (for wav)");
clip = null;
}
// try {
// clip = AudioSystem.getClip();
// } catch(Throwable t) {
// logger.error("Failed to load clip (for wav)");
// t.printStackTrace();
// clip = null;
// }
File battleMusicFolder = new File(TurnBasedMinecraftMod.MUSIC_BATTLE);
File sillyMusicFolder = new File(TurnBasedMinecraftMod.MUSIC_SILLY);
@ -204,19 +207,22 @@ public class BattleMusic
} catch (Throwable t)
{
logger.error("Failed to play battle music (midi)");
t.printStackTrace();
return;
}
sequencer.setLoopCount(Sequencer.LOOP_CONTINUOUSLY);
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())
{
sequencer.stop();
}
if(clip.isActive())
if(clip != null && clip.isActive())
{
clip.stop();
clip.close();
@ -229,10 +235,18 @@ public class BattleMusic
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)
{
logger.error("Failed to play battle music (wav)");
t.printStackTrace();
return;
}
@ -242,6 +256,8 @@ public class BattleMusic
clip.loop(Clip.LOOP_CONTINUOUSLY);
clip.start();
logger.info("Playing music (wav) " + next.getName());
}
else if(suffix.equals("mp3"))
{
@ -279,6 +295,7 @@ public class BattleMusic
catch (Throwable t)
{
logger.error("Failed to play battle music (mp3)");
t.printStackTrace();
return;
}
}

View file

@ -6,11 +6,14 @@ import com.burnedkirby.TurnBasedMinecraft.common.CommonProxy;
import net.minecraft.client.GameSettings;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.util.RegistryKey;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.text.Color;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.World;
import java.util.UUID;
public class ClientProxy extends CommonProxy
{
@ -158,17 +161,21 @@ public class ClientProxy extends CommonProxy
public void displayString(String message)
{
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);
prefix.appendSibling(text);
text.getStyle().setColor(TextFormatting.WHITE).setBold(false);
Minecraft.getInstance().player.sendMessage(prefix);
prefix.getSiblings().add(text);
text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false);
// UUID is required by sendMessage, but appears to be unused, so just give dummy UUID
Minecraft.getInstance().player.sendMessage(prefix, UUID.randomUUID());
}
@Override
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()
@ -228,11 +235,11 @@ public class ClientProxy extends CommonProxy
@Override
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
public Entity getEntity(int id, DimensionType dim) {
public Entity getEntity(int id, RegistryKey<World> dim) {
return Minecraft.getInstance().world.getEntityByID(id);
}
}

View file

@ -1,17 +1,18 @@
package com.burnedkirby.TurnBasedMinecraft.client;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.Entity;
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 boolean isSideA;
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.isSideA = isSideA;
}
@ -25,54 +26,74 @@ public class EntitySelectionButton extends Button
}
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
super.render(mouseX, mouseY, partialTicks);
public void func_230430_a_(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
super.func_230430_a_(matrixStack, mouseX, mouseY, partialTicks);
Entity e = Minecraft.getInstance().world.getEntityByID(entityID);
if(e != null && e instanceof LivingEntity && ((LivingEntity)e).isAlive()) {
int health = (int)(((LivingEntity)e).getHealth() + 0.5f);
int xpos = x;
if (e != null && e instanceof LivingEntity && ((LivingEntity) e).isAlive()) {
int health = (int) (((LivingEntity) e).getHealth() + 0.5f);
int xpos = getX();
int xoffset;
if(isSideA) {
xpos += width + 4;
if (isSideA) {
xpos += getWidth() + 4;
xoffset = 4;
} else {
xpos -= 6;
xoffset = -4;
}
if(health > 200) {
fill(xpos, y + height * 4 / 5, xpos + 2, y + height , 0xFFFF0000);
fill(xpos, y + height * 3 / 5, xpos + 2, y + height * 4 / 5, 0xFFFFFF00);
fill(xpos, y + height * 2 / 5, xpos + 2, y + height * 3 / 5, 0xFF00FF00);
fill(xpos, y + height / 5, xpos + 2, y + height * 2 / 5, 0xFF00FFFF);
fill(xpos, y , xpos + 2, y + height / 5, 0xFF0000FF);
int healthHeight = ((health - 200) * height / 100);
fill(xpos + xoffset, y + height - healthHeight, xpos + xoffset + 2, y + height, 0xFFFFFFFF);
} else if(health > 100) {
fill(xpos, y + height * 4 / 5, xpos + 2, y + height , 0xFFFF0000);
fill(xpos, y + height * 3 / 5, xpos + 2, y + height * 4 / 5, 0xFFFFFF00);
fill(xpos, y + height * 2 / 5, xpos + 2, y + height * 3 / 5, 0xFF00FF00);
fill(xpos, y + height / 5, xpos + 2, y + height * 2 / 5, 0xFF00FFFF);
int healthHeight = ((health - 100) * height / 100);
fill(xpos + xoffset, y + height - healthHeight, xpos + xoffset + 2, y + height, 0xFF0000FF);
} else if(health > 50) {
fill(xpos, y + height * 4 / 5, xpos + 2, y + height , 0xFFFF0000);
fill(xpos, y + height * 3 / 5, xpos + 2, y + height * 4 / 5, 0xFFFFFF00);
fill(xpos, y + height * 2 / 5, xpos + 2, y + height * 3 / 5, 0xFF00FF00);
int healthHeight = ((health - 50) * height / 50);
fill(xpos + xoffset, y + height - healthHeight, xpos + xoffset + 2, y + height, 0xFF00FFFF);
} else if(health > 20) {
fill(xpos, y + height * 4 / 5, xpos + 2, y + height , 0xFFFF0000);
fill(xpos, y + height * 3 / 5, xpos + 2, y + height * 4 / 5, 0xFFFFFF00);
int healthHeight = ((health - 20) * height / 30);
fill(xpos + xoffset, y + height - healthHeight, xpos + xoffset + 2, y + height, 0xFF00FF00);
} else if(health > 10) {
fill(xpos, y + height * 4 / 5, xpos + 2, y + height, 0xFFFF0000);
int healthHeight = ((health - 10) * height / 10);
fill(xpos + xoffset, y + height - healthHeight, xpos + xoffset + 2, y + height, 0xFFFFFF00);
if (health > 200) {
fill(matrixStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000);
fill(matrixStack, xpos, getY() + getHeight() * 3 / 5, xpos + 2, getY() + getHeight() * 4 / 5, 0xFFFFFF00);
fill(matrixStack, xpos, getY() + getHeight() * 2 / 5, xpos + 2, getY() + getHeight() * 3 / 5, 0xFF00FF00);
fill(matrixStack, xpos, getY() + getHeight() / 5, xpos + 2, getY() + getHeight() * 2 / 5, 0xFF00FFFF);
fill(matrixStack, xpos, getY(), xpos + 2, getY() + getHeight() / 5, 0xFF0000FF);
int healthHeight = ((health - 200) * getHeight() / 100);
fill(matrixStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFFFFFFFF);
} else if (health > 100) {
fill(matrixStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000);
fill(matrixStack, xpos, getY() + getHeight() * 3 / 5, xpos + 2, getY() + getHeight() * 4 / 5, 0xFFFFFF00);
fill(matrixStack, xpos, getY() + getHeight() * 2 / 5, xpos + 2, getY() + getHeight() * 3 / 5, 0xFF00FF00);
fill(matrixStack, xpos, getY() + getHeight() / 5, xpos + 2, getY() + getHeight() * 2 / 5, 0xFF00FFFF);
int healthHeight = ((health - 100) * getHeight() / 100);
fill(matrixStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFF0000FF);
} else if (health > 50) {
fill(matrixStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000);
fill(matrixStack, xpos, getY() + getHeight() * 3 / 5, xpos + 2, getY() + getHeight() * 4 / 5, 0xFFFFFF00);
fill(matrixStack, xpos, getY() + getHeight() * 2 / 5, xpos + 2, getY() + getHeight() * 3 / 5, 0xFF00FF00);
int healthHeight = ((health - 50) * getHeight() / 50);
fill(matrixStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFF00FFFF);
} else if (health > 20) {
fill(matrixStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000);
fill(matrixStack, xpos, getY() + getHeight() * 3 / 5, xpos + 2, getY() + getHeight() * 4 / 5, 0xFFFFFF00);
int healthHeight = ((health - 20) * getHeight() / 30);
fill(matrixStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFF00FF00);
} else if (health > 10) {
fill(matrixStack, xpos, getY() + getHeight() * 4 / 5, xpos + 2, getY() + getHeight(), 0xFFFF0000);
int healthHeight = ((health - 10) * getHeight() / 10);
fill(matrixStack, xpos + xoffset, getY() + getHeight() - healthHeight, xpos + xoffset + 2, getY() + getHeight(), 0xFFFFFF00);
} else {
int healthHeight = (health * height / 10);
fill(xpos + xoffset, y + height - healthHeight, xpos + xoffset + 2, y + height, 0xFFFF0000);
int healthHeight = (health * getHeight() / 10);
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,13 +1,14 @@
package com.burnedkirby.TurnBasedMinecraft.client;
import com.mojang.blaze3d.matrix.MatrixStack;
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;
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;
}
@ -16,14 +17,36 @@ public class ItemSelectionButton extends Button
}
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
if(visible) {
boolean hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
if(hovered) {
fill(x, y, x + width, y + height, 0x80FFFFFF);
public void func_230430_a_(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
// field_230694_p_ is probably isVisible
if (field_230694_p_) {
boolean hovered = mouseX >= getX() && mouseY >= getY() && mouseX < getX() + getWidth() && mouseY < getY() + getHeight();
if (hovered) {
fill(matrixStack, getX(), getY(), getX() + getWidth(), getY() + getHeight(), 0x80FFFFFF);
} 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()
&& !config.getBattleIgnoringPlayers().contains(event.getSource().getTrueSource().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))
{
// TurnBasedMinecraftMod.logger.debug("Canceled LivingAttackEvent between " + TurnBasedMinecraftMod.proxy.getAttackingEntity() + " and " + event.getEntity());
@ -157,7 +157,7 @@ public class AttackEventHandler
&& event.getTarget() != null
&& !config.getBattleIgnoringPlayers().contains(event.getEntity().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);
}

View file

@ -14,7 +14,9 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.*;
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;
public class Battle
@ -42,7 +44,7 @@ public class Battle
public String debugLog; // TODO remove after freeze bug has been found
private DimensionType dimension;
private RegistryKey<World> dimension;
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.isServer = isServer;
@ -159,8 +161,8 @@ public class Battle
}
if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled())
{
newCombatant.x = e.posX;
newCombatant.z = e.posZ;
newCombatant.x = e.getPosX();
newCombatant.z = e.getPosZ();
newCombatant.yaw = e.rotationYaw;
newCombatant.pitch = e.rotationPitch;
}
@ -197,8 +199,8 @@ public class Battle
}
if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled())
{
newCombatant.x = e.posX;
newCombatant.z = e.posZ;
newCombatant.x = e.getPosX();
newCombatant.z = e.getPosZ();
newCombatant.yaw = e.rotationYaw;
newCombatant.pitch = e.rotationPitch;
}
@ -339,8 +341,8 @@ public class Battle
}
if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled())
{
newCombatant.x = e.posX;
newCombatant.z = e.posZ;
newCombatant.x = e.getPosX();
newCombatant.z = e.getPosZ();
newCombatant.yaw = e.rotationYaw;
newCombatant.pitch = e.rotationPitch;
}
@ -402,8 +404,8 @@ public class Battle
}
if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled())
{
newCombatant.x = e.posX;
newCombatant.z = e.posZ;
newCombatant.x = e.getPosX();
newCombatant.z = e.getPosZ();
newCombatant.yaw = e.rotationYaw;
newCombatant.pitch = e.rotationPitch;
}
@ -673,11 +675,11 @@ public class Battle
{
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())
{
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 targetEntity = target.entity;
final float yawDirection = Utility.yawDirection(next.entity.posX, next.entity.posZ, target.entity.posX, target.entity.posZ);
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 yawDirection = Utility.yawDirection(next.entity.getPosX(), next.entity.getPosZ(), target.entity.getPosX(), target.entity.getPosZ());
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);
if(TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled())
{
@ -938,7 +940,7 @@ public class Battle
next.pitch = pitchDirection;
}
// 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();
TurnBasedMinecraftMod.proxy.getAttackerViaBowSet().add(new AttackerViaBow(nextEntity, getId()));
itemBow.onPlayerStoppedUsing(((PlayerEntity)nextEntity).getHeldItemMainhand(), nextEntity.getEntityWorld(), (LivingEntity) nextEntity, randomTimeLeft);
@ -973,8 +975,8 @@ public class Battle
final Entity nextEntity = next.entity;
final Entity targetEntity = target.entity;
final EntityInfo targetEntityInfo = target.entityInfo;
final float yawDirection = Utility.yawDirection(next.entity.posX, next.entity.posZ, target.entity.posX, target.entity.posZ);
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 yawDirection = Utility.yawDirection(next.entity.getPosX(), next.entity.getPosZ(), target.entity.getPosX(), target.entity.getPosZ());
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;
if(!(targetEntity instanceof PlayerEntity) && targetEntityInfo.defenseDamage > 0 && targetEntityInfo.defenseDamageProbability > 0)
{
@ -997,7 +999,7 @@ public class Battle
next.pitch = pitchDirection;
}
// 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.setAttackingDamage(0);
((PlayerEntity)nextEntity).attackTargetEntityWithCurrentItem(targetEntity);
@ -1294,7 +1296,7 @@ public class Battle
if(targetItem.getGroup() == ItemGroup.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 int nextItemToUse = next.itemToUse;
((PlayerEntity)nextEntity).inventory.setInventorySlotContents(nextItemToUse, targetItem.onItemUseFinish(targetItemStack, nextEntity.world, (LivingEntity)nextEntity));
@ -1302,7 +1304,7 @@ public class Battle
else if(targetItem instanceof PotionItem)
{
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 int nextItemToUse = next.itemToUse;
((PlayerEntity)nextEntity).inventory.setInventorySlotContents(nextItemToUse, targetItem.onItemUseFinish(targetItemStack, nextEntity.world, (LivingEntity)nextEntity));
@ -1310,7 +1312,7 @@ public class Battle
else
{
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;
case SWITCH_ITEM:

View file

@ -8,7 +8,8 @@ import java.util.Map;
import net.minecraft.entity.player.PlayerEntity;
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.fml.network.PacketDistributor;
import org.apache.logging.log4j.Logger;
@ -141,7 +142,7 @@ public class BattleManager
Collection<Entity> sideB = new ArrayList<Entity>(1);
sideA.add(event.getEntity());
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");
}
else
@ -244,7 +245,7 @@ public class BattleManager
Collection<Entity> sideB = new ArrayList<Entity>(1);
sideA.add(event.getEntity());
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");
}
} 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;
while(battleMap.containsKey(IDCounter))

View file

@ -3,8 +3,10 @@ package com.burnedkirby.TurnBasedMinecraft.common;
import java.util.*;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.RegistryKey;
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 org.apache.logging.log4j.Logger;
@ -160,7 +162,7 @@ public class CommonProxy
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);
}
}

View file

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

View file

@ -35,7 +35,7 @@ public class TurnBasedMinecraftMod
{
public static final String MODID = "com_burnedkirby_turnbasedminecraft";
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 DEFAULT_CONFIG_FILENAME = "TBM_Config_DEFAULT.toml";
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.player.PlayerEntity;
import net.minecraft.item.ArrowItem;
import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.fml.server.ServerLifecycleHooks;
import net.minecraft.util.RegistryKey;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;
public class Utility
{
@ -49,6 +51,15 @@ public class Utility
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 net.minecraft.entity.Entity;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.RegistryKey;
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;
public class PacketBattleMessage
@ -103,11 +105,11 @@ public class PacketBattleMessage
int entityIDTo;
int amount;
String custom;
DimensionType dimension;
RegistryKey<World> dimension;
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.entityIDFrom = entityIDFrom;
@ -117,7 +119,7 @@ public class PacketBattleMessage
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.entityIDFrom = entityIDFrom;
@ -131,7 +133,7 @@ public class PacketBattleMessage
buf.writeInt(pkt.messageType.getValue());
buf.writeInt(pkt.entityIDFrom);
buf.writeInt(pkt.entityIDTo);
buf.writeString(DimensionType.getKey(pkt.dimension).toString());
buf.writeString(Utility.serializeDimension(pkt.dimension));
buf.writeInt(pkt.amount);
buf.writeString(pkt.custom);
}
@ -142,7 +144,7 @@ public class PacketBattleMessage
buf.readInt()),
buf.readInt(),
buf.readInt(),
DimensionType.byName(new ResourceLocation(buf.readString())),
Utility.deserializeDimension(buf.readString()),
buf.readInt(),
buf.readString());
}
@ -154,28 +156,28 @@ public class PacketBattleMessage
String from = "Unknown";
if(fromEntity != null)
{
from = fromEntity.getDisplayName().getFormattedText();
from = fromEntity.getDisplayName().getString();
}
else if(TurnBasedMinecraftMod.proxy.getLocalBattle() != null)
{
fromEntity = TurnBasedMinecraftMod.proxy.getLocalBattle().getCombatantEntity(pkt.entityIDFrom);
if(fromEntity != null)
{
from = fromEntity.getDisplayName().getFormattedText();
from = fromEntity.getDisplayName().getString();
}
}
Entity toEntity = TurnBasedMinecraftMod.proxy.getEntity(pkt.entityIDTo, pkt.dimension);
String to = "Unknown";
if(toEntity != null)
{
to = toEntity.getDisplayName().getFormattedText();
to = toEntity.getDisplayName().getString();
}
else if(TurnBasedMinecraftMod.proxy.getLocalBattle() != null)
{
toEntity = TurnBasedMinecraftMod.proxy.getLocalBattle().getCombatantEntity(pkt.entityIDTo);
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.TurnBasedMinecraftMod;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.text.Color;
import net.minecraft.util.text.ITextComponent;
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.HoverEvent;
import net.minecraftforge.fml.network.NetworkEvent;
@ -137,572 +137,588 @@ public class PacketEditingMessage
{
case ATTACK_ENTITY:
{
ITextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true);
ITextComponent text = new StringTextComponent("Attack the entity you want to edit for TurnBasedMinecraftMod. ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false);
StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
StringTextComponent text = new StringTextComponent("Attack the entity you want to edit for TurnBasedMinecraftMod. ");
text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
ITextComponent cancel = new StringTextComponent("Cancel");
cancel.getStyle().setColor(TextFormatting.RED).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit cancel"));
text.appendSibling(cancel);
StringTextComponent cancel = new StringTextComponent("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.getSiblings().add(cancel);
prefix.appendSibling(text);
prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break;
}
case PICK_EDIT:
{
ITextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true);
ITextComponent text = new StringTextComponent("Edit what value? ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false);
StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
StringTextComponent text = new StringTextComponent("Edit what value? ");
text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
ITextComponent option = new StringTextComponent("IgB");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("IgnoreBattle")));
ITextComponent value = new StringTextComponent("(" + pkt.entityInfo.ignoreBattle + ") ");
value.getStyle().setColor(TextFormatting.WHITE);
option.appendSibling(value);
text.appendSibling(option);
StringTextComponent option = new StringTextComponent("IgB");
// HoverEvent.Action.field_230550_a_ is probably SHOW_TEXT
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"))
.func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("IgnoreBattle"))));
StringTextComponent value = new StringTextComponent("(" + pkt.entityInfo.ignoreBattle + ") ");
value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("AP");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackPower"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("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"))
.func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("AttackPower"))));
value = new StringTextComponent("(" + pkt.entityInfo.attackPower + ") ");
value.getStyle().setColor(TextFormatting.WHITE);
option.appendSibling(value);
text.appendSibling(option);
value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("APr");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackProbability"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("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"))
.func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("AttackProbability"))));
value = new StringTextComponent("(" + pkt.entityInfo.attackProbability + "%) ");
value.getStyle().setColor(TextFormatting.WHITE);
option.appendSibling(value);
text.appendSibling(option);
value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("AV");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackVariance"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("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"))
.func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("AttackVariance"))));
value = new StringTextComponent("(" + pkt.entityInfo.attackVariance + ") ");
value.getStyle().setColor(TextFormatting.WHITE);
option.appendSibling(value);
text.appendSibling(option);
value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("AE");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffect"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("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"))
.func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("AttackEffect"))));
value = new StringTextComponent("(" + pkt.entityInfo.attackEffect.toString() + ") ");
value.getStyle().setColor(TextFormatting.WHITE);
option.appendSibling(value);
text.appendSibling(option);
value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("AEPr");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffectProbability"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("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"))
.func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("AttackEffectProbability"))));
value = new StringTextComponent("(" + pkt.entityInfo.attackEffectProbability + "%) ");
value.getStyle().setColor(TextFormatting.WHITE);
option.appendSibling(value);
text.appendSibling(option);
value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("DD");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamage"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("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"))
.func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("DefenseDamage"))));
value = new StringTextComponent("(" + pkt.entityInfo.defenseDamage + ") ");
value.getStyle().setColor(TextFormatting.WHITE);
option.appendSibling(value);
text.appendSibling(option);
value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("DDPr");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamageProbability"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("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"))
.func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("DefenseDamageProbability"))));
value = new StringTextComponent("(" + pkt.entityInfo.defenseDamageProbability + "%) ");
value.getStyle().setColor(TextFormatting.WHITE);
option.appendSibling(value);
text.appendSibling(option);
value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("E");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit evasion"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("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"))
.func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("Evasion"))));
value = new StringTextComponent("(" + pkt.entityInfo.evasion + "%) ");
value.getStyle().setColor(TextFormatting.WHITE);
option.appendSibling(value);
text.appendSibling(option);
value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("S");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit speed"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("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"))
.func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("Speed"))));
value = new StringTextComponent("(" + pkt.entityInfo.speed + ") ");
value.getStyle().setColor(TextFormatting.WHITE);
option.appendSibling(value);
text.appendSibling(option);
value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("C");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("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"))
.func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("Category"))));
value = new StringTextComponent("(" + pkt.entityInfo.category + ") ");
value.getStyle().setColor(TextFormatting.WHITE);
option.appendSibling(value);
text.appendSibling(option);
value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("DecA");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionAttack"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("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"))
.func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("DecisionAttack"))));
value = new StringTextComponent("(" + pkt.entityInfo.decisionAttack + "%) ");
value.getStyle().setColor(TextFormatting.WHITE);
option.appendSibling(value);
text.appendSibling(option);
value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("DecD");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionDefend"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("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"))
.func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("DecisionDefend"))));
value = new StringTextComponent("(" + pkt.entityInfo.decisionDefend + "%) ");
value.getStyle().setColor(TextFormatting.WHITE);
option.appendSibling(value);
text.appendSibling(option);
value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("DecF");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionFlee"))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("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"))
.func_240716_a_(new HoverEvent(HoverEvent.Action.field_230550_a_, new StringTextComponent("DecisionFlee"))));
value = new StringTextComponent("(" + pkt.entityInfo.decisionFlee + "%) ");
value.getStyle().setColor(TextFormatting.WHITE);
option.appendSibling(value);
text.appendSibling(option);
value.func_230530_a_(value.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
option.getSiblings().add(value);
text.getSiblings().add(option);
option = new StringTextComponent("Finished Editing");
option.getStyle().setColor(TextFormatting.GREEN).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit finish"));
text.appendSibling(option).appendText(" ");
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.getSiblings().add(option);
text.getSiblings().add(new StringTextComponent(" "));
option = new StringTextComponent("Cancel");
option.getStyle().setColor(TextFormatting.RED).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit cancel"));
text.appendSibling(option);
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.getSiblings().add(option);
prefix.appendSibling(text);
prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break;
}
case EDIT_IGNORE_BATTLE:
{
ITextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true);
ITextComponent text = new StringTextComponent("ignoreBattle: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false);
StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
StringTextComponent text = new StringTextComponent("ignoreBattle: ");
text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
ITextComponent option = new StringTextComponent("true");
option.getStyle().setColor(TextFormatting.GREEN).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle true"));
text.appendSibling(option);
StringTextComponent option = new StringTextComponent("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.getSiblings().add(option);
text.appendText(" ");
text.getSiblings().add(new StringTextComponent(" "));
option = new StringTextComponent("false");
option.getStyle().setColor(TextFormatting.RED).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle false"));
text.appendSibling(option);
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.getSiblings().add(option);
prefix.appendSibling(text);
prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break;
}
case EDIT_ATTACK_POWER:
{
ITextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true);
ITextComponent text = new StringTextComponent("attackPower: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false);
StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
StringTextComponent text = new StringTextComponent("attackPower: ");
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)
{
ITextComponent 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)));
text.appendSibling(option);
StringTextComponent option = new StringTextComponent(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.getSiblings().add(option);
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);
break;
}
case EDIT_ATTACK_PROBABILITY:
{
ITextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true);
ITextComponent text = new StringTextComponent("attackProbability: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false);
StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
StringTextComponent text = new StringTextComponent("attackProbability: ");
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)
{
ITextComponent 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)));
text.appendSibling(option);
StringTextComponent option = new StringTextComponent(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.getSiblings().add(option);
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);
break;
}
case EDIT_ATTACK_VARIANCE:
{
ITextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true);
ITextComponent text = new StringTextComponent("attackVariance: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false);
StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
StringTextComponent text = new StringTextComponent("attackVariance: ");
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)
{
ITextComponent 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)));
text.appendSibling(option);
StringTextComponent option = new StringTextComponent(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.getSiblings().add(option);
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);
break;
}
case EDIT_ATTACK_EFFECT:
{
ITextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true);
ITextComponent text = new StringTextComponent("attackEffect: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false);
StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
StringTextComponent text = new StringTextComponent("attackEffect: ");
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())
{
ITextComponent option = new StringTextComponent(e.toString());
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffect " + e.toString()));
text.appendSibling(option);
StringTextComponent option = new StringTextComponent(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.getSiblings().add(option);
if(e != EntityInfo.Effect.UNKNOWN)
{
// 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);
break;
}
case EDIT_ATTACK_EFFECT_PROBABILITY:
{
ITextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true);
ITextComponent text = new StringTextComponent("attackEffectProbability: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false);
StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
StringTextComponent text = new StringTextComponent("attackEffectProbability: ");
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)
{
ITextComponent 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)));
text.appendSibling(option);
StringTextComponent option = new StringTextComponent(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.getSiblings().add(option);
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);
break;
}
case EDIT_DEFENSE_DAMAGE:
{
ITextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true);
ITextComponent text = new StringTextComponent("defenseDamage: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false);
StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
StringTextComponent text = new StringTextComponent("defenseDamage: ");
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)
{
ITextComponent 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)));
text.appendSibling(option);
StringTextComponent option = new StringTextComponent(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.getSiblings().add(option);
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);
break;
}
case EDIT_DEFENSE_DAMAGE_PROBABILITY:
{
ITextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true);
ITextComponent text = new StringTextComponent("defenseDamageProbability: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false);
StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
StringTextComponent text = new StringTextComponent("defenseDamageProbability: ");
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)
{
ITextComponent 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)));
text.appendSibling(option);
StringTextComponent option = new StringTextComponent(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.getSiblings().add(option);
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);
break;
}
case EDIT_EVASION:
{
ITextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true);
ITextComponent text = new StringTextComponent("evasion: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false);
StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
StringTextComponent text = new StringTextComponent("evasion: ");
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)
{
ITextComponent 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)));
text.appendSibling(option);
StringTextComponent option = new StringTextComponent(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.getSiblings().add(option);
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);
break;
}
case EDIT_SPEED:
{
ITextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true);
ITextComponent text = new StringTextComponent("speed: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false);
StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
StringTextComponent text = new StringTextComponent("speed: ");
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)
{
ITextComponent 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)));
text.appendSibling(option);
StringTextComponent option = new StringTextComponent(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.getSiblings().add(option);
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);
break;
}
case EDIT_CATEGORY:
{
ITextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true);
ITextComponent text = new StringTextComponent("category: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false);
StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
StringTextComponent text = new StringTextComponent("category: ");
text.func_230530_a_(text.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)).func_240713_a_(false));
ITextComponent option = new StringTextComponent("monster");
option.getStyle().setColor(TextFormatting.YELLOW).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category monster"));
StringTextComponent option = new StringTextComponent("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"))
{
ITextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.getStyle().setColor(TextFormatting.WHITE);
ITextComponent optionInfoBool = new StringTextComponent("disabled");
optionInfoBool.getStyle().setColor(TextFormatting.RED);
optionInfo.appendSibling(optionInfoBool).appendText(")");
option.appendSibling(optionInfo);
StringTextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
StringTextComponent optionInfoBool = new StringTextComponent("disabled");
optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)));
optionInfo.getSiblings().add(optionInfoBool);
optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
}
else
{
ITextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.getStyle().setColor(TextFormatting.WHITE);
ITextComponent optionInfoBool = new StringTextComponent("enabled");
optionInfoBool.getStyle().setColor(TextFormatting.GREEN);
optionInfo.appendSibling(optionInfoBool).appendText(")");
option.appendSibling(optionInfo);
StringTextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
StringTextComponent optionInfoBool = new StringTextComponent("enabled");
optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)));
optionInfo.getSiblings().add(optionInfoBool);
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.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"))
{
ITextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.getStyle().setColor(TextFormatting.WHITE);
ITextComponent optionInfoBool = new StringTextComponent("disabled");
optionInfoBool.getStyle().setColor(TextFormatting.RED);
optionInfo.appendSibling(optionInfoBool).appendText(")");
option.appendSibling(optionInfo);
StringTextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
StringTextComponent optionInfoBool = new StringTextComponent("disabled");
optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)));
optionInfo.getSiblings().add(optionInfoBool);
optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
}
else
{
ITextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.getStyle().setColor(TextFormatting.WHITE);
ITextComponent optionInfoBool = new StringTextComponent("enabled");
optionInfoBool.getStyle().setColor(TextFormatting.GREEN);
optionInfo.appendSibling(optionInfoBool).appendText(")");
option.appendSibling(optionInfo);
StringTextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
StringTextComponent optionInfoBool = new StringTextComponent("enabled");
optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)));
optionInfo.getSiblings().add(optionInfoBool);
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.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"))
{
ITextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.getStyle().setColor(TextFormatting.WHITE);
ITextComponent optionInfoBool = new StringTextComponent("disabled");
optionInfoBool.getStyle().setColor(TextFormatting.RED);
optionInfo.appendSibling(optionInfoBool).appendText(")");
option.appendSibling(optionInfo);
StringTextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
StringTextComponent optionInfoBool = new StringTextComponent("disabled");
optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)));
optionInfo.getSiblings().add(optionInfoBool);
optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
}
else
{
ITextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.getStyle().setColor(TextFormatting.WHITE);
ITextComponent optionInfoBool = new StringTextComponent("enabled");
optionInfoBool.getStyle().setColor(TextFormatting.GREEN);
optionInfo.appendSibling(optionInfoBool).appendText(")");
option.appendSibling(optionInfo);
StringTextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
StringTextComponent optionInfoBool = new StringTextComponent("enabled");
optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)));
optionInfo.getSiblings().add(optionInfoBool);
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.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"))
{
ITextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.getStyle().setColor(TextFormatting.WHITE);
ITextComponent optionInfoBool = new StringTextComponent("disabled");
optionInfoBool.getStyle().setColor(TextFormatting.RED);
optionInfo.appendSibling(optionInfoBool).appendText(")");
option.appendSibling(optionInfo);
StringTextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
StringTextComponent optionInfoBool = new StringTextComponent("disabled");
optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)));
optionInfo.getSiblings().add(optionInfoBool);
optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
}
else
{
ITextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.getStyle().setColor(TextFormatting.WHITE);
ITextComponent optionInfoBool = new StringTextComponent("enabled");
optionInfoBool.getStyle().setColor(TextFormatting.GREEN);
optionInfo.appendSibling(optionInfoBool).appendText(")");
option.appendSibling(optionInfo);
StringTextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
StringTextComponent optionInfoBool = new StringTextComponent("enabled");
optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)));
optionInfo.getSiblings().add(optionInfoBool);
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.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"))
{
ITextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.getStyle().setColor(TextFormatting.WHITE);
ITextComponent optionInfoBool = new StringTextComponent("disabled");
optionInfoBool.getStyle().setColor(TextFormatting.RED);
optionInfo.appendSibling(optionInfoBool).appendText(")");
option.appendSibling(optionInfo);
StringTextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
StringTextComponent optionInfoBool = new StringTextComponent("disabled");
optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFF0000)));
optionInfo.getSiblings().add(optionInfoBool);
optionInfo.getSiblings().add(new StringTextComponent(")"));
option.getSiblings().add(optionInfo);
}
else
{
ITextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.getStyle().setColor(TextFormatting.WHITE);
ITextComponent optionInfoBool = new StringTextComponent("enabled");
optionInfoBool.getStyle().setColor(TextFormatting.GREEN);
optionInfo.appendSibling(optionInfoBool).appendText(")");
option.appendSibling(optionInfo);
StringTextComponent optionInfo = new StringTextComponent("(battle-");
optionInfo.func_230530_a_(optionInfo.getStyle().func_240718_a_(Color.func_240743_a_(0xFFFFFFFF)));
StringTextComponent optionInfoBool = new StringTextComponent("enabled");
optionInfoBool.func_230530_a_(optionInfoBool.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)));
optionInfo.getSiblings().add(optionInfoBool);
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);
break;
}
case EDIT_DECISION_ATTACK:
{
ITextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true);
ITextComponent text = new StringTextComponent("decisionAttack: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false);
StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
StringTextComponent text = new StringTextComponent("decisionAttack: ");
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)
{
ITextComponent 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)));
text.appendSibling(option);
StringTextComponent option = new StringTextComponent(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.getSiblings().add(option);
if(i < 100)
{
text.appendText(", ");
text.getSiblings().add(new StringTextComponent(", "));
}
}
prefix.appendSibling(text);
prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break;
}
case EDIT_DECISION_DEFEND:
{
ITextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true);
ITextComponent text = new StringTextComponent("decisionDefend: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false);
StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
StringTextComponent text = new StringTextComponent("decisionDefend: ");
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)
{
ITextComponent 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)));
text.appendSibling(option);
StringTextComponent option = new StringTextComponent(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.getSiblings().add(option);
if(i < 100)
{
text.appendText(", ");
text.getSiblings().add(new StringTextComponent(", "));
}
}
prefix.appendSibling(text);
prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
break;
}
case EDIT_DECISION_FLEE:
{
ITextComponent prefix = new StringTextComponent("TBM: ");
prefix.getStyle().setColor(TextFormatting.GREEN).setBold(true);
ITextComponent text = new StringTextComponent("decisionFlee: ");
text.getStyle().setColor(TextFormatting.WHITE).setBold(false);
StringTextComponent prefix = new StringTextComponent("TBM: ");
prefix.func_230530_a_(prefix.getStyle().func_240718_a_(Color.func_240743_a_(0xFF00FF00)).func_240713_a_(true));
StringTextComponent text = new StringTextComponent("decisionFlee: ");
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)
{
ITextComponent 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)));
text.appendSibling(option);
StringTextComponent option = new StringTextComponent(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.getSiblings().add(option);
if(i < 100)
{
text.appendText(", ");
text.getSiblings().add(new StringTextComponent(", "));
}
}
prefix.appendSibling(text);
prefix.getSiblings().add(text);
TurnBasedMinecraftMod.proxy.displayTextComponent(prefix);
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
modLoader="javafml" #mandatory
# 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
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
[[mods]] #mandatory
# The modid of the mod
modId="com_burnedkirby_turnbasedminecraft" #mandatory
# 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
displayName="TurnBasedMinecraftMod" #mandatory
# 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
mandatory=true #mandatory
# 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
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
@ -47,6 +48,6 @@ Implements turn-based-battle in Minecraft.
[[dependencies.com_burnedkirby_turnbasedminecraft]]
modId="minecraft"
mandatory=true
versionRange="[1.14.4]"
versionRange="[1.16.3,)"
ordering="NONE"
side="BOTH"