From c307f141b126d35a0ce47d197d9c7fcafacd2a52 Mon Sep 17 00:00:00 2001 From: Thutmose Date: Mon, 10 Oct 2022 19:27:19 -0400 Subject: [PATCH] fixes some gui localisation issues --- .../core/client/gui/helper/GuardEntry.java | 28 +++++++++++-------- .../resources/assets/pokecube/lang/en_us.json | 5 ++++ .../pokecube_adventures/lang/en_us.json | 18 ++++++------ 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/src/main/java/pokecube/core/client/gui/helper/GuardEntry.java b/src/main/java/pokecube/core/client/gui/helper/GuardEntry.java index 86a3a73c65..201eeaa869 100644 --- a/src/main/java/pokecube/core/client/gui/helper/GuardEntry.java +++ b/src/main/java/pokecube/core/client/gui/helper/GuardEntry.java @@ -122,7 +122,7 @@ public void addOrRemove(Consumer remover) this.location.visible = false; this.timeperiod.visible = false; this.variation.visible = false; - + remover.accept(this.delete); remover.accept(this.confirm); remover.accept(this.moveUp); @@ -217,9 +217,12 @@ public void moveUpClicked(final Button b) this.reOrder(-1); } - private BlockPos posFromText(final String text) + private BlockPos posFromText(String text) { if (text.isEmpty()) return null; + text = text.replace("(", "").replace(")", ""); + text = text.replace(",", ""); + while (text.contains(" ")) text = text.replace(" ", " "); final String[] args = text.split(" "); if (args.length == 3) try { @@ -231,14 +234,14 @@ private BlockPos posFromText(final String text) catch (final NumberFormatException e) { // Send status message about not working here. - final Component mess = TComponent.translatable("traineredit.info.pos.formaterror"); - this.parent.getMinecraft().player.displayClientMessage(mess, true); + final Component mess = TComponent.translatable("pokecube.route.info.pos.formatinfo"); + this.parent.getMinecraft().player.displayClientMessage(mess, false); } else if (args.length != 0) { // Send status message about not working here. - final Component mess = TComponent.translatable("traineredit.info.pos.formatinfo"); - this.parent.getMinecraft().player.displayClientMessage(mess, true); + final Component mess = TComponent.translatable("pokecube.route.info.pos.formatinfo"); + this.parent.getMinecraft().player.displayClientMessage(mess, false); } return null; } @@ -313,9 +316,10 @@ public void reOrder(final int dir) this.function.apply(data); } - public TimePeriod timeFromText(final String text) + public TimePeriod timeFromText(String text) { if (text.isEmpty()) return null; + text = text.replace("(", "").replace(")", ""); final String[] args = text.split(" "); if (args.length == 2) try { @@ -326,14 +330,14 @@ public TimePeriod timeFromText(final String text) catch (final NumberFormatException e) { // Send status message about not working here. - final Component mess = TComponent.translatable("traineredit.info.time.formaterror"); - this.parent.getMinecraft().player.displayClientMessage(mess, true); + final Component mess = TComponent.translatable("pokecube.route.info.time.formaterror"); + this.parent.getMinecraft().player.displayClientMessage(mess, false); } else if (args.length != 0) { // Send status message about not working here. - final Component mess = TComponent.translatable("traineredit.info.time.formatinfo"); - this.parent.getMinecraft().player.displayClientMessage(mess, true); + final Component mess = TComponent.translatable("pokecube.route.info.time.formatinfo"); + this.parent.getMinecraft().player.displayClientMessage(mess, false); } return null; } @@ -349,7 +353,7 @@ public void update() } catch (final NumberFormatException e) { - final Component mess = TComponent.translatable("traineredit.info.dist.formatinfo"); + final Component mess = TComponent.translatable("pokecube.route.info.dist.formaterror"); this.parent.getMinecraft().player.displayClientMessage(mess, false); return; } diff --git a/src/main/resources/assets/pokecube/lang/en_us.json b/src/main/resources/assets/pokecube/lang/en_us.json index 94dc4ed207..76554b07bf 100644 --- a/src/main/resources/assets/pokecube/lang/en_us.json +++ b/src/main/resources/assets/pokecube/lang/en_us.json @@ -129,6 +129,11 @@ "pokecube.gui.move.up.desc": "Move Up", "pokecube.gui.move.down.desc": "Move Down", + "pokecube.route.info.dist.formaterror": "§cError with distance format!", + "pokecube.route.info.time.formaterror": "§cTime period is in ticks!", + "pokecube.route.info.time.formatinfo": "§cError, Wrong format; Correct time format is: (startick endtick)", + "pokecube.route.info.pos.formatinfo": "§cError, Wrong format; Correct location format is: (x y z)", + "_comment": "Pokemob Gui", "pokemob.stance.guard": "Guarding", diff --git a/src/main/resources/assets/pokecube_adventures/lang/en_us.json b/src/main/resources/assets/pokecube_adventures/lang/en_us.json index fe9fa5870f..5acdce6d9c 100644 --- a/src/main/resources/assets/pokecube_adventures/lang/en_us.json +++ b/src/main/resources/assets/pokecube_adventures/lang/en_us.json @@ -149,14 +149,14 @@ "traineredit.set.look": "Look Angle set to %s.", "traineredit.set.levels": "Set levelling mode to %s.", - "traineredit.title.Pokémob": "Edit Pokémob", + "traineredit.title.pokemob": "Edit Pokémob", "traineredit.title.message": "Event Messages and Actions", "traineredit.title.aipage": "AI Settings", "traineredit.title.rewards": "Defeat Rewards", "traineredit.title.trades": "Edit Trades", "traineredit.title.routes": "Edit Routes", - "traineredit.info.Pokémob": "Pokémob", + "traineredit.info.pokemob": "Pokémob", "traineredit.info.moves": "Moves", "traineredit.info.level": "Level", "traineredit.info.evs": "EVs", @@ -181,7 +181,7 @@ "traineredit.button.home": "Back", "traineredit.button.delete": "Delete", - "traineredit.button.newPokémob": "Add New", + "traineredit.button.newpokemob": "Add New", "traineredit.button.rewards": "Rewards", "traineredit.button.trades": "Trades", "traineredit.button.routes": "Routes", @@ -211,14 +211,14 @@ "traineredit.button.leader": "Leader", "traineredit.button.trader": "Trader", - "gui.jei.Pokémobs": "Pokémob Evolution", - "gui.jei.Pokémobs.interact": "Pokémob Interactions", - "gui.jei.Pokémobs.moves": "Pokémob Move Recipes", + "gui.jei.pokemobs": "Pokémob Evolution", + "gui.jei.pokemobs.interact": "Pokémob Interactions", + "gui.jei.pokemobs.moves": "Pokémob Move Recipes", - "gui.jei.Pokémob.gender.male": "Male", - "gui.jei.Pokémob.gender.female": "Female", + "gui.jei.pokemob.gender.male": "Male", + "gui.jei.pokemob.gender.female": "Female", - "gui.jei.Pokémob.nogender": "If not %s", + "gui.jei.pokemob.nogender": "If not %s", "gui.jei.cloner.need_egg": "Also Requires an additional Egg in the Egg input slot",