From d6ead4a4e9562bcfb23e1cc427a3c9f4e4222dec Mon Sep 17 00:00:00 2001 From: Discreater Date: Sat, 1 May 2021 21:06:57 +0800 Subject: [PATCH] chore: clean up --- .../jecalculation/data/Controller.java | 27 ++-- .../jecalculation/data/label/ILabel.java | 5 +- .../data/label/labels/LFluidStack.java | 2 +- .../data/label/labels/LOreDict.java | 2 +- .../data/label/labels/LPlaceholder.java | 2 +- .../data/structure/CostList.java | 47 +++--- .../jecalculation/data/structure/Recipes.java | 53 ++++--- .../jecalculation/gui/guis/GuiCalculator.java | 6 +- .../gui/guis/GuiDisambiguation.java | 2 +- .../jecalculation/gui/guis/GuiImport.java | 4 +- .../jecalculation/gui/guis/GuiRecipe.java | 11 +- .../jecalculation/gui/guis/GuiSearch.java | 45 +++--- .../gui/guis/pickers/PickerPlaceholder.java | 8 +- .../gui/guis/pickers/PickerSimple.java | 15 +- .../jecalculation/gui/widgets/WButton.java | 3 +- .../jecalculation/gui/widgets/WHelp.java | 12 +- .../gui/widgets/WLabelScroll.java | 10 +- .../jecalculation/gui/widgets/WPage.java | 5 + .../jecalculation/gui/widgets/WTooltip.java | 20 ++- .../google/common/collect/Streams.java | 136 ++++++++++++++++++ .../jecalculation/utils/Utilities.java | 28 ++-- .../assets/jecalculation/lang/en_US.lang | 39 +++-- 22 files changed, 341 insertions(+), 141 deletions(-) create mode 100644 src/main/java/me/towdium/jecalculation/polyfill/google/common/collect/Streams.java diff --git a/src/main/java/me/towdium/jecalculation/data/Controller.java b/src/main/java/me/towdium/jecalculation/data/Controller.java index b9bcac5..13bb5cb 100644 --- a/src/main/java/me/towdium/jecalculation/data/Controller.java +++ b/src/main/java/me/towdium/jecalculation/data/Controller.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; +import java.util.stream.Stream; /** * Author: towdium @@ -64,11 +65,11 @@ public class Controller { public static void inport(Recipes recipes, String group) { ArrayList buffer = new ArrayList<>(); - recipes.flatStream(group).forEach(i -> - getRecord().flatStream(group).filter(j -> j.one.equals(i.one)).findAny().orElseGet(() -> { - buffer.add(i.one); - return null; - })); + recipes.getGroup(group).forEach(i -> + getRecord().getGroup(group).stream().filter(j -> j.equals(i)).findAny().orElseGet(() -> { + buffer.add(i); + return null; + })); for (Recipe r : buffer) addRecipe(group, r); } @@ -107,18 +108,22 @@ public class Controller { return getRecord().getRecipe(group, index); } - public static List> getRecipes() { + public static Stream>> stream() { + return getRecord().stream(); + } + + public static Recipes.RecipeIterator recipeIterator() { + return getRecord().recipeIterator(); + } + + public static List getRecipes() { return getRecord().getRecipes(); } - public static List> getRecipes(String group) { + public static List getRecipes(String group) { return getRecord().getRecipes(group); } - public static Optional getRecipe(ILabel label) { - return getRecord().getRecipe(label); - } - public static String getAmount() { return amountClient; } diff --git a/src/main/java/me/towdium/jecalculation/data/label/ILabel.java b/src/main/java/me/towdium/jecalculation/data/label/ILabel.java index 6e32044..df8854a 100644 --- a/src/main/java/me/towdium/jecalculation/data/label/ILabel.java +++ b/src/main/java/me/towdium/jecalculation/data/label/ILabel.java @@ -15,8 +15,6 @@ import me.towdium.jecalculation.gui.guis.pickers.PickerSimple; import me.towdium.jecalculation.polyfill.mc.client.renderer.GlStateManager; import me.towdium.jecalculation.utils.Utilities; import me.towdium.jecalculation.utils.Utilities.ReversedIterator; -import me.towdium.jecalculation.utils.wrappers.Pair; -import me.towdium.jecalculation.utils.wrappers.Wrapper; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -29,7 +27,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Optional; -import java.util.function.BiFunction; import java.util.function.BiPredicate; import java.util.function.Function; import java.util.function.Supplier; @@ -464,7 +461,7 @@ public interface ILabel { public void getToolTip(List existing, boolean detailed) { if (detailed) existing.add( - FORMAT_GREY + Utilities.I18n.format("label.common.tooltip.amount", getAmountString(false))); + FORMAT_GREY + Utilities.I18n.get("label.common.tooltip.amount", getAmountString(false))); } @Override diff --git a/src/main/java/me/towdium/jecalculation/data/label/labels/LFluidStack.java b/src/main/java/me/towdium/jecalculation/data/label/labels/LFluidStack.java index 92ac67d..88140cc 100644 --- a/src/main/java/me/towdium/jecalculation/data/label/labels/LFluidStack.java +++ b/src/main/java/me/towdium/jecalculation/data/label/labels/LFluidStack.java @@ -122,7 +122,7 @@ public class LFluidStack extends ILabel.Impl { @SideOnly(Side.CLIENT) public void getToolTip(List existing, boolean detailed) { if (detailed) existing.add(FORMAT_GREY + - Utilities.I18n.format("label.common.tooltip.amount", Long.toString(getAmount())) + "mB"); + Utilities.I18n.get("label.common.tooltip.amount", Long.toString(getAmount())) + "mB"); existing.add(FORMAT_BLUE + FORMAT_ITALIC + Utilities.getModName(fluid)); } diff --git a/src/main/java/me/towdium/jecalculation/data/label/labels/LOreDict.java b/src/main/java/me/towdium/jecalculation/data/label/labels/LOreDict.java index eacd84d..ba343b3 100644 --- a/src/main/java/me/towdium/jecalculation/data/label/labels/LOreDict.java +++ b/src/main/java/me/towdium/jecalculation/data/label/labels/LOreDict.java @@ -75,7 +75,7 @@ public class LOreDict extends ILabel.Impl { @Override @SideOnly(Side.CLIENT) public String getDisplayName() { - return Utilities.I18n.format("label.ore_dict.name", name); + return Utilities.I18n.get("label.ore_dict.name", name); } public static boolean mergeSame(ILabel a, ILabel b) { diff --git a/src/main/java/me/towdium/jecalculation/data/label/labels/LPlaceholder.java b/src/main/java/me/towdium/jecalculation/data/label/labels/LPlaceholder.java index c97e963..0a0ef74 100644 --- a/src/main/java/me/towdium/jecalculation/data/label/labels/LPlaceholder.java +++ b/src/main/java/me/towdium/jecalculation/data/label/labels/LPlaceholder.java @@ -92,7 +92,7 @@ public class LPlaceholder extends ILabel.Impl { @Override @SideOnly(Side.CLIENT) public String getDisplayName() { - return Utilities.I18n.format("label.placeholder.name", name); + return Utilities.I18n.get("label.placeholder.name", name); } @Override diff --git a/src/main/java/me/towdium/jecalculation/data/structure/CostList.java b/src/main/java/me/towdium/jecalculation/data/structure/CostList.java index 2cd5720..6a183d5 100644 --- a/src/main/java/me/towdium/jecalculation/data/structure/CostList.java +++ b/src/main/java/me/towdium/jecalculation/data/structure/CostList.java @@ -26,10 +26,6 @@ public class CostList { labels = new ArrayList<>(); } - public CostList(ILabel label) { - labels = Collections.singletonList(label.copy().multiply(-1)); - } - public CostList(List labels) { this.labels = labels.stream() .filter(i -> i != ILabel.EMPTY) @@ -43,12 +39,6 @@ public class CostList { merge(new CostList(negative), false, true); } - - public CostList(Recipe recipe) { - this(Arrays.stream(recipe.getLabel(OUTPUT)).filter(i -> i != ILabel.EMPTY).collect(Collectors.toList()), - Arrays.stream(recipe.getLabel(INPUT)).filter(i -> i != ILabel.EMPTY).collect(Collectors.toList())); - } - @SuppressWarnings("UnusedReturnValue") public CostList merge(CostList costList, boolean strict, boolean inplace) { CostList ret = inplace ? this : copy(); @@ -121,6 +111,7 @@ public class CostList { public class Calculator { ArrayList> procedure = new ArrayList<>(); ArrayList catalysts = new ArrayList<>(); + Recipes.RecipeIterator iterator = Controller.recipeIterator(); private int index; public Calculator() throws ArithmeticException { @@ -130,14 +121,20 @@ public class CostList { int count = 0; while (next != null) { CostList original = getCurrent(); - CostList difference = new CostList(next.one); - difference.multiply(next.two); - CostList result = original.merge(difference, false, false); - if (set.contains(result)) - next = find(false); + List outL = Arrays.stream(next.one.getLabel(OUTPUT)) + .filter(i -> i != ILabel.EMPTY).collect(Collectors.toList()); + CostList outC = new CostList(outL); + outC.multiply(-next.two); + List inL = Arrays.stream(next.one.getLabel(INPUT)) + .filter(i -> i != ILabel.EMPTY).collect(Collectors.toList()); + CostList inC = new CostList(inL); + inC.multiply(next.two); + CostList result = original.merge(outC, false, false); + result.merge(inC, false, true); + if (set.contains(result)) next = find(false); else { set.add(result); - procedure.add(new Pair<>(result, difference)); + procedure.add(new Pair<>(result, outC)); addCatalyst(next.one.getLabel(Recipe.IO.CATALYST)); next = find(true); } @@ -151,14 +148,19 @@ public class CostList { @Nullable private Pair find(boolean reset) { - index = reset ? 0 : index + 1; + if (reset) { + index = 0; + iterator = Controller.recipeIterator(); + } List labels = getCurrent().labels; for (; index < labels.size(); index++) { ILabel label = labels.get(index); - if (label.getAmount() >= 0) - continue; - Optional recipe = Controller.getRecipe(label); - if (recipe.isPresent()) return new Pair<>(recipe.get(), recipe.get().multiplier(label)); + if (label.getAmount() >= 0) continue; + while (iterator.hasNext()) { + Recipe r = iterator.next(); + if (r.matches(label)) return new Pair<>(r, r.multiplier(label)); + } + iterator = Controller.recipeIterator(); } return null; } @@ -195,9 +197,8 @@ public class CostList { } public List getSteps() { - //noinspection OptionalGetWithoutIsPresent List ret = procedure.stream() - .map(i -> i.two.labels.stream().filter(l -> l.getAmount() > 0).findFirst().get()) + .map(i -> i.two.labels.get(0)) .collect(Collectors.toList()); Collections.reverse(ret); return ret; diff --git a/src/main/java/me/towdium/jecalculation/data/structure/Recipes.java b/src/main/java/me/towdium/jecalculation/data/structure/Recipes.java index 918bd73..dab0122 100644 --- a/src/main/java/me/towdium/jecalculation/data/structure/Recipes.java +++ b/src/main/java/me/towdium/jecalculation/data/structure/Recipes.java @@ -2,6 +2,7 @@ package me.towdium.jecalculation.data.structure; import me.towdium.jecalculation.data.label.ILabel; import me.towdium.jecalculation.polyfill.NBTHelper; +import me.towdium.jecalculation.utils.wrappers.Pair; import me.towdium.jecalculation.utils.wrappers.Trio; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -60,19 +61,8 @@ public class Recipes { return records.size(); } - public Stream>> stream() { - return records.entrySet().stream(); - } - - public Stream> flatStream() { - return records.entrySet().stream().flatMap(i -> - IntStream.range(0, i.getValue().size()).mapToObj(j -> - new Trio<>(i.getValue().get(j), i.getKey(), j))); - } - - public Stream> flatStream(String group) { - List l = records.get(group); - return IntStream.range(0, l.size()).mapToObj(j -> new Trio<>(l.get(j), group, j)); + public Stream>> stream() { + return records.entrySet().stream().map(i -> new Pair<>(i.getKey(), i.getValue())); } public void remove(String group, int index) { @@ -85,17 +75,14 @@ public class Recipes { return getGroup(group).get(index); } - public List> getRecipes() { - return flatStream().collect(Collectors.toCollection(ArrayList::new)); + public List getRecipes() { + return records.values().stream().flatMap(Collection::stream).collect(Collectors.toList()); } - public List> getRecipes(String group) { - return flatStream(group).collect(Collectors.toCollection(ArrayList::new)); + public List getRecipes(String group) { + return records.get(group); } - public Optional getRecipe(ILabel label) { - return flatStream().map(i -> i.one).filter(i -> i.matches(label)).findFirst(); - } public void forEach(BiConsumer> consumer) { records.forEach(consumer); } @@ -116,10 +103,34 @@ public class Recipes { public List getGroups() { - return records.keySet().stream().sorted().collect(Collectors.toList()); + return new ArrayList<>(records.keySet()); } public NBTTagCompound serialize() { return serialize(records.keySet()); } + + public RecipeIterator recipeIterator() { + return new RecipeIterator(); + } + + public class RecipeIterator implements Iterator { + Iterator>> i = records.entrySet().iterator(); + Iterator j; + + @Override + public boolean hasNext() { + while (j == null || !j.hasNext()) { + if (i.hasNext()) j = i.next().getValue().iterator(); + else return false; + } + return j.hasNext(); + } + + @Override + public Recipe next() { + while (j == null || !j.hasNext()) if (i.hasNext()) j = i.next().getValue().iterator(); + return j.next(); + } + } } diff --git a/src/main/java/me/towdium/jecalculation/gui/guis/GuiCalculator.java b/src/main/java/me/towdium/jecalculation/gui/guis/GuiCalculator.java index b007f60..b359aea 100644 --- a/src/main/java/me/towdium/jecalculation/gui/guis/GuiCalculator.java +++ b/src/main/java/me/towdium/jecalculation/gui/guis/GuiCalculator.java @@ -35,11 +35,11 @@ public class GuiCalculator extends WContainer implements IGui { WLabelScroll result = new WLabelScroll(7, 87, 8, 4, WLabel.Mode.RESULT, true); WButton steps = new WButtonIcon(64, 62, 20, 20, Resource.BTN_LIST, "calculator.step") .setListener(i -> setMode(Mode.STEPS)); - WButton catalyst = new WButtonIcon(45, 62, 20, 20, Resource.BTN_CAT, "calculator.catalyst") + WButton catalyst = new WButtonIcon(45, 62, 20, 20, Resource.BTN_CAT, "common.catalyst") .setListener(i -> setMode(Mode.CATALYST)); - WButton output = new WButtonIcon(26, 62, 20, 20, Resource.BTN_OUT, "calculator.output") + WButton output = new WButtonIcon(26, 62, 20, 20, Resource.BTN_OUT, "common.output") .setListener(i -> setMode(Mode.OUTPUT)); - WButton input = new WButtonIcon(7, 62, 20, 20, Resource.BTN_IN, "calculator.input") + WButton input = new WButtonIcon(7, 62, 20, 20, Resource.BTN_IN, "common.input") .setListener(i -> setMode(Mode.INPUT)); WTextField amount = new WTextField(60, 7, 65).setText(Controller.getAmount()).setListener(i -> { Controller.setAmount(i.getText()); diff --git a/src/main/java/me/towdium/jecalculation/gui/guis/GuiDisambiguation.java b/src/main/java/me/towdium/jecalculation/gui/guis/GuiDisambiguation.java index 82780e8..ad199ee 100644 --- a/src/main/java/me/towdium/jecalculation/gui/guis/GuiDisambiguation.java +++ b/src/main/java/me/towdium/jecalculation/gui/guis/GuiDisambiguation.java @@ -28,7 +28,7 @@ public class GuiDisambiguation extends IPicker.Impl implements IGui { public GuiDisambiguation(List> record) { this.record = record; WSwitcher switcher = new WSwitcher(7, 7, 162, this.record.size()).setListener(i -> setPage(i.getIndex())); - ListenerValue consumer = (i, v) -> callback.accept(v.copy().multiply(-1)); + ListenerValue consumer = (i, v) -> callback.accept(i.get(v).copy().multiply(-1)); add(new WPanel()); add(new WIcon(7, 48, 18, 54, ICN_LIST, "disambiguation.list")); add(new WIcon(7, 105, 18, 54, ICN_LABEL, "disambiguation.label")); diff --git a/src/main/java/me/towdium/jecalculation/gui/guis/GuiImport.java b/src/main/java/me/towdium/jecalculation/gui/guis/GuiImport.java index a91ac34..3ec8696 100644 --- a/src/main/java/me/towdium/jecalculation/gui/guis/GuiImport.java +++ b/src/main/java/me/towdium/jecalculation/gui/guis/GuiImport.java @@ -53,8 +53,8 @@ public class GuiImport extends WContainer implements IGui, ISearchable { @Override public void onVisible(JecaGui gui) { data = Controller.discover().stream() - .flatMap(i -> i.two.stream().map(j -> new Quad<>(false, i.one, j.getKey(), i.two))) - .collect(Collectors.toList()); + .flatMap(i -> i.two.stream().map(j -> new Quad<>(false, i.one, j.one, i.two))) + .collect(Collectors.toList()); search.refresh(); } diff --git a/src/main/java/me/towdium/jecalculation/gui/guis/GuiRecipe.java b/src/main/java/me/towdium/jecalculation/gui/guis/GuiRecipe.java index 644b7ff..97aba3f 100644 --- a/src/main/java/me/towdium/jecalculation/gui/guis/GuiRecipe.java +++ b/src/main/java/me/towdium/jecalculation/gui/guis/GuiRecipe.java @@ -6,7 +6,6 @@ import me.towdium.jecalculation.data.label.ILabel; import me.towdium.jecalculation.data.structure.CostList; import me.towdium.jecalculation.data.structure.Recipe; import me.towdium.jecalculation.gui.JecaGui; -import me.towdium.jecalculation.gui.Resource; import me.towdium.jecalculation.gui.widgets.*; import me.towdium.jecalculation.nei.NEIPlugin; import me.towdium.jecalculation.utils.Utilities; @@ -76,7 +75,7 @@ public class GuiRecipe extends WContainer implements IGui { textField.setText(""); setNewGroup(false); }); - WButton buttonNo = new WButtonIcon(26, 33, 20, 20, BTN_NO, "recipe.cancel").setListener(i -> setNewGroup(false)); + WButton buttonNo = new WButtonIcon(26, 33, 20, 20, BTN_NO, "common.cancel").setListener(i -> setNewGroup(false)); WButton buttonNew = new WButtonIcon(7, 33, 20, 20, BTN_NEW, "recipe.new").setListener(i -> setNewGroup(true)); public GuiRecipe(String group, int index) { @@ -91,12 +90,12 @@ public class GuiRecipe extends WContainer implements IGui { public GuiRecipe() { addAll(new WHelp("recipe"), new WPanel()); - add(new WIcon(7, 63, 21, 20, ICN_OUTPUT, "recipe.output")); - add(new WIcon(7, 87, 21, 20, ICN_CATALYST, "recipe.catalyst")); - add(new WIcon(7, 111, 21, 40, ICN_INPUT, "recipe.input")); + add(new WIcon(7, 63, 21, 20, ICN_OUTPUT, "common.output")); + add(new WIcon(7, 87, 21, 20, ICN_CATALYST, "common.catalyst")); + add(new WIcon(7, 111, 21, 40, ICN_INPUT, "common.input")); add(new WLine(57)); addAll(groupInput, groupCatalyst, groupOutput, switcherGroup); - if (switcherGroup.getTexts().isEmpty()) switcherGroup.setTemp(Utilities.I18n.format("common.default")); + if (switcherGroup.getTexts().isEmpty()) switcherGroup.setTemp(Utilities.I18n.get("gui.common.default")); setNewGroup(false); buttonCopy.setDisabled(true); buttonDel.setDisabled(true); diff --git a/src/main/java/me/towdium/jecalculation/gui/guis/GuiSearch.java b/src/main/java/me/towdium/jecalculation/gui/guis/GuiSearch.java index 2e2ec2c..59d8332 100644 --- a/src/main/java/me/towdium/jecalculation/gui/guis/GuiSearch.java +++ b/src/main/java/me/towdium/jecalculation/gui/guis/GuiSearch.java @@ -3,8 +3,8 @@ package me.towdium.jecalculation.gui.guis; import me.towdium.jecalculation.data.Controller; import me.towdium.jecalculation.data.structure.Recipe; import me.towdium.jecalculation.gui.JecaGui; -import me.towdium.jecalculation.gui.Resource; import me.towdium.jecalculation.gui.widgets.*; +import me.towdium.jecalculation.polyfill.google.common.collect.Streams; import me.towdium.jecalculation.utils.Utilities; import me.towdium.jecalculation.utils.wrappers.Trio; import net.minecraft.client.Minecraft; @@ -13,19 +13,17 @@ import net.minecraft.util.ChatComponentTranslation; import java.io.File; import java.util.ArrayList; import java.util.List; +import java.util.function.Supplier; import java.util.stream.Collectors; import static me.towdium.jecalculation.gui.Resource.*; import static me.towdium.jecalculation.gui.widgets.WLabel.Mode.PICKER; public class GuiSearch extends WContainer implements IGui { - List> content; WSwitcher group; WButton export; - WLabelScroll labels = new WLabelScroll(7, 51, 8, 6, PICKER, true).setListener((i, v) -> content.stream() - .filter(j -> j.one.getRep() == v) - .findFirst() - .ifPresent(j -> JecaGui.displayGui(true, true, new GuiRecipe(j.two, j.three)))); - + List> recipes; + WLabelScroll labels = new WLabelScroll(7, 51, 8, 6, PICKER, true).setListener((i, v) -> + JecaGui.displayGui(true, true, new GuiRecipe(recipes.get(v).two, recipes.get(v).three))); public GuiSearch() { add(new WPanel()); @@ -36,25 +34,34 @@ public class GuiSearch extends WContainer implements IGui { add(labels); } + private void generate() { + if (group.getIndex() == 0) { + recipes = Controller.stream() + .flatMap(i -> Streams.mapWithIndex(i.two.stream(), (j, k) -> new Trio<>(j, i.one, (int) k))) + .collect(Collectors.toList()); + } else { + String s = group.getText(); + recipes = Streams.mapWithIndex(Controller.getRecipes(s).stream(), (i, j) -> new Trio<>(i, s, (int) j)) + .collect(Collectors.toList()); + } + } + public void refresh() { - int iGroup = group.getIndex(); - content = iGroup == 0 ? Controller.getRecipes() : Controller.getRecipes(group.getText()); - labels.setLabels(content.stream().map(i -> i.one.getRep()).collect(Collectors.toCollection(ArrayList::new))); remove(export); - String tooltip, name; - List> recipes; - if (iGroup == 0) { + String tooltip; + Supplier func; + generate(); + if (group.getIndex() == 0) { tooltip = "search.export_all"; - name = null; - recipes = Controller.getRecipes(); + func = Controller::export; } else { tooltip = "search.export_group"; - name = Controller.getGroups().get(iGroup - 1); - recipes = Controller.getRecipes(name); + func = () -> Controller.export(group.getText()); } + labels.setLabels(recipes.stream().map(i -> i.one.getRep()).collect(Collectors.toList())); export = new WButtonIcon(149, 25, 20, 20, BTN_OUT, tooltip).setListener(i -> { - File f = iGroup == 0 ? Controller.export() : Controller.export(name); + File f = func.get(); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation( "jecalculation.chat.export", f.getAbsolutePath())); }).setDisabled(recipes.size() == 0); @@ -65,7 +72,7 @@ public class GuiSearch extends WContainer implements IGui { public void onVisible(JecaGui gui) { removeAll(group); ArrayList groups = new ArrayList<>(); - groups.add(Utilities.I18n.format("gui.search.all")); + groups.add(Utilities.I18n.get("gui.search.all")); groups.addAll(Controller.getGroups()); int index = group == null ? 0 : group.getIndex(); if (index >= groups.size()) index = groups.size() - 1; diff --git a/src/main/java/me/towdium/jecalculation/gui/guis/pickers/PickerPlaceholder.java b/src/main/java/me/towdium/jecalculation/gui/guis/pickers/PickerPlaceholder.java index 3765013..26ab731 100644 --- a/src/main/java/me/towdium/jecalculation/gui/guis/pickers/PickerPlaceholder.java +++ b/src/main/java/me/towdium/jecalculation/gui/guis/pickers/PickerPlaceholder.java @@ -23,14 +23,14 @@ import static me.towdium.jecalculation.gui.Resource.ICN_TEXT; public class PickerPlaceholder extends IPicker.Impl implements IGui { public PickerPlaceholder() { WLabelScroll scroll = new WLabelScroll(7, 69, 8, 5, WLabel.Mode.PICKER, true) - .setLabels(LPlaceholder.getRecent()).setListener((i, v) -> notifyLsnr(v)); + .setLabels(LPlaceholder.getRecent()).setListener((i, v) -> notifyLsnr(i.get(v))); WTextField create = new WTextField(26, 7, 69) .setListener(i -> i.setColor(i.getText().equals("") ? COLOR_TEXT_RED : COLOR_TEXT_WHITE)); add(new WSearch(26, 45, 90, scroll)); - add(new WIcon(7, 45, 20, 20, ICN_TEXT, "picker_placeholder.text_search")); - add(new WIcon(7, 7, 20, 20, ICN_TEXT, "picker_placeholder.text_create")); + add(new WIcon(7, 45, 20, 20, ICN_TEXT, "common.search")); + add(new WIcon(7, 7, 20, 20, ICN_TEXT, "placeholder.create")); add(new WLine(36)); - add(new WButtonIcon(95, 7, 20, 20, BTN_YES).setListener(i -> { + add(new WButtonIcon(95, 7, 20, 20, BTN_YES, "common.confirm").setListener(i -> { if (!create.getText().equals("")) callback.accept(new LPlaceholder(create.getText(), 1)); })); addAll(scroll, create); diff --git a/src/main/java/me/towdium/jecalculation/gui/guis/pickers/PickerSimple.java b/src/main/java/me/towdium/jecalculation/gui/guis/pickers/PickerSimple.java index c2503a5..3318cbf 100644 --- a/src/main/java/me/towdium/jecalculation/gui/guis/pickers/PickerSimple.java +++ b/src/main/java/me/towdium/jecalculation/gui/guis/pickers/PickerSimple.java @@ -27,29 +27,26 @@ import static me.towdium.jecalculation.gui.Resource.ICN_TEXT; public class PickerSimple extends IPicker.Impl implements IGui { /** * @param labels label to be displayed for selection - * @param l18nKey localization key for help string, - * entire key should be "gui.l18nKey.help.tooltip" */ - public PickerSimple(List labels, String l18nKey) { + public PickerSimple(List labels) { WLabelScroll ls = new WLabelScroll(7, 33, 8, 7, WLabel.Mode.PICKER, true).setLabels(labels) - .setListener((i, v) -> notifyLsnr(v)); + .setListener((i, v) -> notifyLsnr(i.get(v))); add(new WSearch(26, 7, 90, ls)); - add(new WIcon(7, 7, 20, 20, ICN_TEXT, l18nKey + ".text")); + add(new WIcon(7, 7, 20, 20, ICN_TEXT, "common.search")); add(ls); } public static class FluidStack extends PickerSimple { public FluidStack() { - super(FluidRegistry.getRegisteredFluids().values().stream() - .map(fluid -> new LFluidStack(1000, fluid)).collect(Collectors.toList()), - "picker_fluid_stack"); + super(FluidRegistry.getRegisteredFluids().entrySet().stream() + .map(e -> new LFluidStack(1000, e.getValue())).collect(Collectors.toList())); } } public static class OreDict extends PickerSimple { public OreDict() { - super(generate(), "picker_ore_dict"); + super(generate()); } static List generate() { diff --git a/src/main/java/me/towdium/jecalculation/gui/widgets/WButton.java b/src/main/java/me/towdium/jecalculation/gui/widgets/WButton.java index e7a98ea..44d726c 100644 --- a/src/main/java/me/towdium/jecalculation/gui/widgets/WButton.java +++ b/src/main/java/me/towdium/jecalculation/gui/widgets/WButton.java @@ -9,7 +9,6 @@ import me.towdium.jecalculation.utils.ClientUtils; import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; import java.util.Arrays; -import java.util.Collections; import java.util.List; import static me.towdium.jecalculation.gui.Resource.*; @@ -83,6 +82,6 @@ public abstract class WButton extends WTooltip { @Override protected List getSuffix() { - return disabled ? Arrays.asList("disabled", "active") : Collections.singletonList("active"); + return disabled ? Arrays.asList("disabled", "active", "") : Arrays.asList("active", ""); } } diff --git a/src/main/java/me/towdium/jecalculation/gui/widgets/WHelp.java b/src/main/java/me/towdium/jecalculation/gui/widgets/WHelp.java index db41e7f..dec2ae0 100644 --- a/src/main/java/me/towdium/jecalculation/gui/widgets/WHelp.java +++ b/src/main/java/me/towdium/jecalculation/gui/widgets/WHelp.java @@ -27,6 +27,7 @@ public class WHelp extends WTooltip { @Override public void onDraw(JecaGui gui, int xMouse, int yMouse) { + super.onDraw(gui, xMouse, yMouse); gui.drawResourceContinuous(WGT_PANEL_N, -21, 0, 25, 24, 4); gui.drawResource(WGT_HELP_N, -19, 2); } @@ -49,7 +50,7 @@ public class WHelp extends WTooltip { Text tContent = new Text(); WSwitcher sPage = new WSwitcher(7, 146, 162, tContent.amount()); sPage.setListener(i -> tContent.setPage(i.getIndex())); - WText tTitle = new WText(7, 7, SHADOW, I18n.format("gui." + WHelp.this.key + ".title")); + WText tTitle = new WText(7, 7, SHADOW, I18n.get("gui." + WHelp.this.key + ".title")); addAll(new WPanel(), new Icon(), tTitle, tContent, sPage); } @@ -65,7 +66,7 @@ public class WHelp extends WTooltip { int page; public Text() { - List ss = I18n.wrap(I18n.format("gui." + WHelp.this.key + ".help"), 162); + List ss = I18n.wrap(I18n.get("gui." + WHelp.this.key + ".help"), 162); List tmp = new ArrayList<>(); int count = 0; for (String s : ss) { @@ -109,10 +110,17 @@ public class WHelp extends WTooltip { @Override public void onDraw(JecaGui gui, int xMouse, int yMouse) { + super.onDraw(gui, xMouse, yMouse); gui.drawResourceContinuous(WGT_HELP_B, -21, 0, 25, 24, 4); gui.drawResource(WGT_HELP_F, -19, 2); } + @Override + public boolean onTooltip(JecaGui gui, int xMouse, int yMouse, List tooltip) { + super.onTooltip(gui, xMouse, yMouse, tooltip); + return mouseIn(xMouse, yMouse); + } + @Override public boolean onClicked(JecaGui gui, int xMouse, int yMouse, int button) { boolean ret = mouseIn(xMouse, yMouse); diff --git a/src/main/java/me/towdium/jecalculation/gui/widgets/WLabelScroll.java b/src/main/java/me/towdium/jecalculation/gui/widgets/WLabelScroll.java index 0197a7c..f853077 100644 --- a/src/main/java/me/towdium/jecalculation/gui/widgets/WLabelScroll.java +++ b/src/main/java/me/towdium/jecalculation/gui/widgets/WLabelScroll.java @@ -25,7 +25,7 @@ public class WLabelScroll extends WContainer implements ISearchable { protected WScroll scroll; protected int xPos, yPos, column, row, current; protected String filter = ""; - protected ListenerValue listener; + protected ListenerValue listener; public WLabelScroll(int xPos, int yPos, int column, int row, WLabel.Mode mode, boolean drawConnection) { this.xPos = xPos; @@ -33,7 +33,7 @@ public class WLabelScroll extends WContainer implements ISearchable { this.column = column; this.row = row; labelGroup = new WLabelGroup(xPos, yPos, column, row, mode).setListener((i, v) -> { - if (listener != null) listener.invoke(this, i.get(v)); + if (listener != null) listener.invoke(this, column * current + v); }); scroll = new WScroll(xPos + column * 18 + 4, yPos, row * 18).setListener(i -> update(i.getCurrent())); add(labelGroup); @@ -61,6 +61,10 @@ public class WLabelScroll extends WContainer implements ISearchable { return in; } + public ILabel get(int index) { + return filtered.get(index); + } + private float getPos(int step) { return 1f / (getStepAmount() - 1) * step; } @@ -81,7 +85,7 @@ public class WLabelScroll extends WContainer implements ISearchable { } @SuppressWarnings("UnusedReturnValue") - public WLabelScroll setListener(ListenerValue listener) { + public WLabelScroll setListener(ListenerValue listener) { this.listener = listener; return this; } diff --git a/src/main/java/me/towdium/jecalculation/gui/widgets/WPage.java b/src/main/java/me/towdium/jecalculation/gui/widgets/WPage.java index 94013ce..09b4aa6 100644 --- a/src/main/java/me/towdium/jecalculation/gui/widgets/WPage.java +++ b/src/main/java/me/towdium/jecalculation/gui/widgets/WPage.java @@ -39,6 +39,11 @@ public class WPage extends WTooltip { super.onDraw(gui, xMouse, yMouse); } + @Override + public boolean onTooltip(JecaGui gui, int xMouse, int yMouse, List tooltip) { + return super.onTooltip(gui, xMouse, yMouse, tooltip) || mouseIn(xMouse, yMouse); + } + @Override public boolean onClicked(JecaGui gui, int xMouse, int yMouse, int button) { boolean ret = JecaGui.mouseIn(index * 24, -21, 24, 21, xMouse, yMouse) && listener != null && !focused; diff --git a/src/main/java/me/towdium/jecalculation/gui/widgets/WTooltip.java b/src/main/java/me/towdium/jecalculation/gui/widgets/WTooltip.java index 03a469e..5c8d97d 100644 --- a/src/main/java/me/towdium/jecalculation/gui/widgets/WTooltip.java +++ b/src/main/java/me/towdium/jecalculation/gui/widgets/WTooltip.java @@ -4,11 +4,15 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import me.towdium.jecalculation.gui.JecaGui; import me.towdium.jecalculation.utils.Utilities; +import me.towdium.jecalculation.utils.wrappers.Pair; import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; + +import static java.lang.String.join; /** * Author: towdium @@ -27,22 +31,26 @@ public abstract class WTooltip implements IWidget { @Override public void onDraw(JecaGui gui, int xMouse, int yMouse) { - if (name != null) timer.setState(mouseIn(xMouse, yMouse)); + if (name != null) + timer.setState(mouseIn(xMouse, yMouse)); } @Override public boolean onTooltip(JecaGui gui, int xMouse, int yMouse, List tooltip) { if (timer.getTime() > 500) { - String str = getSuffix().stream().map(s -> Utilities.I18n.search(String.join(".", "gui", name, s))) - .filter(p -> p.two).findFirst().map(p -> p.one) - .orElse(JecaGui.ALWAYS_TOOLTIP ? String.join(".", "gui", name, getSuffix().get(0)) : null); - if (str != null) tooltip.add(str); + List> suffix = getSuffix().stream().map(s -> Utilities.I18n + .search(s.isEmpty() ? join(".", "gui", name) : join(".", "gui", name, s))) + .collect(Collectors.toList()); + String str = suffix.stream().filter(p -> p.two).findFirst().map(p -> p.one) + .orElse(JecaGui.ALWAYS_TOOLTIP ? suffix.get(0).one : null); + if (str != null) + tooltip.add(str); } return false; } protected List getSuffix() { - return Collections.singletonList("tooltip"); + return Collections.singletonList(""); } public abstract boolean mouseIn(int xMouse, int yMouse); diff --git a/src/main/java/me/towdium/jecalculation/polyfill/google/common/collect/Streams.java b/src/main/java/me/towdium/jecalculation/polyfill/google/common/collect/Streams.java new file mode 100644 index 0000000..1d7763f --- /dev/null +++ b/src/main/java/me/towdium/jecalculation/polyfill/google/common/collect/Streams.java @@ -0,0 +1,136 @@ +package me.towdium.jecalculation.polyfill.google.common.collect; + +import javax.annotation.Nullable; +import java.util.Iterator; +import java.util.Spliterator; +import java.util.Spliterators; +import java.util.function.Consumer; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; + +import static com.google.common.base.Preconditions.checkNotNull; + +public class Streams { + public interface FunctionWithIndex { + /** Applies this function to the given argument and its index within a stream. */ + R apply(T from, long index); + } + + /** + * Returns a stream consisting of the results of applying the given function to the elements of + * {@code stream} and their indices in the stream. For example, + * + *
{@code
+     * mapWithIndex(
+     *     Stream.of("a", "b", "c"),
+     *     (str, index) -> str + ":" + index)
+     * }
+ * + *

would return {@code Stream.of("a:0", "b:1", "c:2")}. + * + *

The resulting stream is efficiently splittable + * if and only if {@code stream} was efficiently splittable and its underlying spliterator + * reported {@link Spliterator#SUBSIZED}. This is generally the case if the underlying stream + * comes from a data structure supporting efficient indexed random access, typically an array or + * list. + * + *

The order of the resulting stream is defined if and only if the order of the original stream + * was defined. + */ + public static Stream mapWithIndex( + Stream stream, FunctionWithIndex function) { + checkNotNull(stream); + checkNotNull(function); + boolean isParallel = stream.isParallel(); + Spliterator fromSpliterator = stream.spliterator(); + + if (!fromSpliterator.hasCharacteristics(Spliterator.SUBSIZED)) { + Iterator fromIterator = Spliterators.iterator(fromSpliterator); + return StreamSupport.stream( + new Spliterators.AbstractSpliterator( + fromSpliterator.estimateSize(), + fromSpliterator.characteristics() & (Spliterator.ORDERED | Spliterator.SIZED)) { + long index = 0; + + @Override + public boolean tryAdvance(Consumer action) { + if (fromIterator.hasNext()) { + action.accept(function.apply(fromIterator.next(), index++)); + return true; + } + return false; + } + }, + isParallel); + } + class Splitr extends MapWithIndexSpliterator, R, Splitr> implements Consumer { + T holder; + + Splitr(Spliterator splitr, long index) { + super(splitr, index); + } + + @Override + public void accept(@Nullable T t) { + this.holder = t; + } + + @Override + public boolean tryAdvance(Consumer action) { + if (fromSpliterator.tryAdvance(this)) { + try { + action.accept(function.apply(holder, index++)); + return true; + } finally { + holder = null; + } + } + return false; + } + + @Override + Splitr createSplit(Spliterator from, long i) { + return new Splitr(from, i); + } + } + return StreamSupport.stream(new Splitr(fromSpliterator, 0), isParallel); + } + + private abstract static class MapWithIndexSpliterator< + F extends Spliterator, R, S extends MapWithIndexSpliterator> + implements Spliterator { + final F fromSpliterator; + long index; + + MapWithIndexSpliterator(F fromSpliterator, long index) { + this.fromSpliterator = fromSpliterator; + this.index = index; + } + + abstract S createSplit(F from, long i); + + @Override + public S trySplit() { + @SuppressWarnings("unchecked") + F split = (F) fromSpliterator.trySplit(); + if (split == null) { + return null; + } + S result = createSplit(split, index); + this.index += split.getExactSizeIfKnown(); + return result; + } + + @Override + public long estimateSize() { + return fromSpliterator.estimateSize(); + } + + @Override + public int characteristics() { + return fromSpliterator.characteristics() + & (Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED); + } + } +} diff --git a/src/main/java/me/towdium/jecalculation/utils/Utilities.java b/src/main/java/me/towdium/jecalculation/utils/Utilities.java index d5d7100..38e9bac 100644 --- a/src/main/java/me/towdium/jecalculation/utils/Utilities.java +++ b/src/main/java/me/towdium/jecalculation/utils/Utilities.java @@ -14,7 +14,9 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.*; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; import net.minecraftforge.fluids.Fluid; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringEscapeUtils; @@ -24,7 +26,6 @@ import javax.annotation.ParametersAreNonnullByDefault; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; -import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.text.BreakIterator; import java.text.DecimalFormat; @@ -36,6 +37,8 @@ import java.util.function.Supplier; import java.util.stream.Stream; import java.util.stream.StreamSupport; +import static net.minecraft.client.resources.I18n.format; + /** * Author: Towdium * Date: 2016/6/25. @@ -45,16 +48,19 @@ import java.util.stream.StreamSupport; public class Utilities { // FLOAT FORMATTING public static char[] suffix = new char[]{'K', 'M', 'B', 'G', 'T'}; - public static DecimalFormat[] format = new DecimalFormat[]{ - new DecimalFormat("#."), new DecimalFormat("#.#"), new DecimalFormat("#.##"), - new DecimalFormat("#.###"), new DecimalFormat("#.####") - }; + public static DecimalFormat[] format = new DecimalFormat[]{new DecimalFormat("#."), + new DecimalFormat("#.#"), + new DecimalFormat("#.##"), + new DecimalFormat("#.###"), + new DecimalFormat("#.####")}; public static String cutNumber(float f, int size) { BiFunction form = (fl, len) -> format[len - 1 - (int) Math.log10(fl)].format(fl); int scale = (int) Math.log10(f) / 3; - if (scale == 0) return form.apply(f, size); - else return form.apply(f / (float) Math.pow(1000, scale), size - 1) + suffix[scale - 1]; + if (scale == 0) + return form.apply(f, size); + else + return form.apply(f / (float) Math.pow(1000, scale), size - 1) + suffix[scale - 1]; } @SuppressWarnings("OptionalUsedAsFieldOrParameterType") @@ -103,7 +109,7 @@ public class Utilities { @Nullable public V get(K a, K b) { V ret = data.get(new Pair<>(a, b)); - if (ret == null) data.get(new Pair<>(b, a)); + if (ret == null) ret = data.get(new Pair<>(b, a)); return ret; } } @@ -212,14 +218,14 @@ public class Utilities { public static Pair search(String translateKey, Object... parameters) { Pair ret = new Pair<>(null, null); translateKey = "jecalculation." + translateKey; - String buffer = net.minecraft.client.resources.I18n.format(translateKey, parameters); + String buffer = format(translateKey, parameters); ret.two = !buffer.equals(translateKey); buffer = StringEscapeUtils.unescapeJava(buffer); ret.one = buffer.replace("\t", " "); return ret; } - public static String format(String translateKey, Object... parameters) { + public static String get(String translateKey, Object... parameters) { return search(translateKey, parameters).one; } diff --git a/src/main/resources/assets/jecalculation/lang/en_US.lang b/src/main/resources/assets/jecalculation/lang/en_US.lang index 0cf630b..f1a30a9 100644 --- a/src/main/resources/assets/jecalculation/lang/en_US.lang +++ b/src/main/resources/assets/jecalculation/lang/en_US.lang @@ -9,30 +9,47 @@ jecalculation.chat.export=Selected recipes has been exported to "%s". jecalculation.gui.calculator.recipe.active=New recipe jecalculation.gui.calculator.help=Welcome to the main interface of the mod. The first thing suggested to do is to use the two buttons in the upper right to input the recipes, which allows you to create and edit recipes. All of the calculations require recipes to be recorded.\fTo calculate the cost of an item, simply pick the item from JEIs item list then put it in the slot in the upper left of the interface with all of the recipes to use recorded. The result will then be displayed in the lower slots of the interface. The four buttons provide options to display input, output, catalyst and crafting steps.\fThe button in the upper left allows you to edit and get a label. Labels are a very important part of the mod. They are basically things that can be put into a slot, including ItemStack, FluidStack, OreDict entry, or simply a placeholder. Lables are used in the calculation process. Most of time they are quite clever as long as you configure them properly. jecalculation.gui.calculator.title=Crafting Calculator -jecalculation.gui.recipe.save.active=Save +jecalculation.gui.calculator.label=Add label +jecalculation.gui.calculator.step=Steps +jecalculation.gui.calculator.recipe=Add recipe +jecalculation.gui.calculator.search=Search recipe +jecalculation.gui.recipe.save=Save jecalculation.gui.recipe.copy.active=Save as new recipe jecalculation.gui.recipe.copy.disabled=Cannot save as new recipe\nbecause you are not editing a recipe -jecalculation.gui.recipe.clear.active=Clear grid -jecalculation.gui.recipe.label.active=Add label +jecalculation.gui.recipe.delete.active=Delete recipe +jecalculation.gui.recipe.delete.disabled=Cannot delete recipe because\nyou are not editing a recipe +jecalculation.gui.recipe.clear=Clear grid +jecalculation.gui.recipe.label=Add label +jecalculation.gui.recipe.confirm.active=Confirm +jecalculation.gui.recipe.confirm.disabled=Cannot use empty string as group name jecalculation.gui.recipe.disamb.active=Open disambiguate settings jecalculation.gui.recipe.disamb.disabled=Disambiguate settings not available\nbecause of no ambiguous element -jecalculation.gui.recipe.new.active=New group -jecalculation.gui.recipe.cancel.active=Cancel -jecalculation.gui.recipe.confirm.active=Confirm +jecalculation.gui.recipe.new=New group jecalculation.gui.recipe.title=Recipe Editing jecalculation.gui.recipe.help=This interface allows you to create or edit recipes. To create one recipe, you can pick items from the JEI item list, then put it into the slots. When finished, simply click the save button. You can also fast transer recipes from JEI by clicking "+" when openning recipe view.\fTo edit one label, you can simply click it, then a toolbar will pop up to help you, where you can switch between amount and percentage mode, type the amount, or remove the label. In addition, you can use mouse scroll to quickly change the amount. Clicking the "Clear" button will remove all of the labels.\fUsing recipe fast transfer, some labels will automatically setup for you, like oreDict labels. If you do not want this behavoir, simply use "Disambiguous" button to select manually. You can also add labels by ckicking the "Add label" button. By the way, normally you shouldn't put fuzzy labels as output.\fYou can easily manage recipes using groups. Click the "New group" button, type the group name and hit the tick, you are done. The new group name will show in the top bar. If you already have groups set up and you want to use an existing one, you can use the arrows to select between them.\fWhen you are editing an existing recipe, you will have two extra buttons, "Save as" and "Delete". "Save as" allows you to save the current recipe as a new recipe, without changing the existing one. "Delete" simply allows you to delete the recipe. jecalculation.gui.label.title=Label Editing jecalculation.gui.label.help=This interface allows you to create labels. This mod provides 4 types of labels: fluid, oreDict, placeholder and item. To create fluid and oreDict label, you can just search and pick. Item labels represent an item stack, but with fuzzy options for meta, nbt and capalibity.\fAs is indicated by the name, Placeholder labels do not hold any content. It is just a string to connect recipes. You can use it for anything, like structure or event energy. To create one, simply type in the name, then hit the tick. You can also search and pick from existing ones. jecalculation.gui.search.all=All -jecalculation.gui.search.input=Input -jecalculation.gui.search.output=Output -jecalculation.gui.search.catalyst=Catalyst +jecalculation.gui.search.import=Import recipes +jecalculation.gui.search.export_group.active=Export recipes in current group +jecalculation.gui.search.export_all.active=Export all recorded recipes +jecalculation.gui.search.export_group.disabled=Cannot export because no recipe recorded +jecalculation.gui.search.export_all.disabled=Cannot export because no recipe recorded +jecalculation.gui.placeholder.create=Create new placeholder jecalculation.gui.common.label.ore=OreDict jecalculation.gui.common.label.fluid=Fluid jecalculation.gui.common.label.placeholder=Placeholder jecalculation.gui.common.label.item=Item +jecalculation.gui.common.search=Search +jecalculation.gui.common.input=Inputs +jecalculation.gui.common.output=Outputs +jecalculation.gui.common.catalyst=Catalysts +jecalculation.gui.common.default=Default +jecalculation.gui.common.help=Help +jecalculation.gui.common.close=Close +jecalculation.gui.common.confirm=Confirm +jecalculation.gui.common.cancel=Cancel jecalculation.config.force_client=Force Client jecalculation.label.ore_dict.name=Ore: %s jecalculation.label.placeholder.name=Placeholder: %s -jecalculation.label.common.tooltip.amount=Amount: %s -jecalculation.common.default=Default +jecalculation.label.common.amount=Amount: %s