From 08d80d588a36598114087a79917e36e9d2cc97c3 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Tue, 24 Dec 2019 11:31:40 +0800 Subject: Finishing workstation usage and close #220 --- .../rei/gui/entries/SimpleRecipeEntry.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java') diff --git a/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java b/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java index 0906e5a2d..2a53f534d 100644 --- a/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java +++ b/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java @@ -25,12 +25,12 @@ import java.util.function.Supplier; import java.util.stream.Collectors; public class SimpleRecipeEntry extends RecipeEntry { - + private static final Comparator ENTRY_COMPARATOR = Comparator.comparingLong(EntryStack::hashCode); private static final Identifier CHEST_GUI_TEXTURE = new Identifier("roughlyenoughitems", "textures/gui/recipecontainer.png"); private List inputWidgets; private EntryWidget outputWidget; - + protected SimpleRecipeEntry(List> input, List output) { List, AtomicInteger>> newList = Lists.newArrayList(); List, Integer>> a = CollectionUtils.map(input, stacks -> new Pair<>(stacks, stacks.stream().map(EntryStack::getAmount).max(Integer::compareTo).orElse(1))); @@ -53,15 +53,15 @@ public class SimpleRecipeEntry extends RecipeEntry { }).collect(Collectors.toList()); this.outputWidget = EntryWidget.create(0, 0).entries(CollectionUtils.filter(output, stack -> !stack.isEmpty())).noBackground().noHighlight().noTooltips(); } - + public static RecipeEntry create(Supplier>> input, Supplier> output) { return create(input.get(), output.get()); } - + public static RecipeEntry create(List> input, List output) { return new SimpleRecipeEntry(input, output); } - + public static boolean equalsList(List list_1, List list_2) { List stacks_1 = list_1.stream().distinct().sorted(ENTRY_COMPARATOR).collect(Collectors.toList()); List stacks_2 = list_2.stream().distinct().sorted(ENTRY_COMPARATOR).collect(Collectors.toList()); @@ -74,7 +74,7 @@ public class SimpleRecipeEntry extends RecipeEntry { return false; return true; } - + @Override public void render(Rectangle bounds, int mouseX, int mouseY, float delta) { int xx = bounds.x + 4, yy = bounds.y + 2; @@ -101,7 +101,7 @@ public class SimpleRecipeEntry extends RecipeEntry { outputWidget.getBounds().setLocation(xx, yy); outputWidget.render(mouseX, mouseY, delta); } - + @Nullable @Override public QueuedTooltip getTooltip(int mouseX, int mouseY) { @@ -113,18 +113,18 @@ public class SimpleRecipeEntry extends RecipeEntry { return outputWidget.getCurrentTooltip(mouseX, mouseY); return null; } - + @Override public int getHeight() { return 4 + getItemsHeight() * 18; } - + public int getItemsHeight() { return MathHelper.ceil(((float) inputWidgets.size()) / (getItemsPerLine() - 2)); } - + public int getItemsPerLine() { return MathHelper.floor((getWidth() - 4f) / 18f); } - + } -- cgit