aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/plugin/DefaultCustomDisplay.java
diff options
context:
space:
mode:
authorDaniel She <shekwancheung0528@gmail.com>2019-02-25 21:18:26 +0800
committerGitHub <noreply@github.com>2019-02-25 21:18:26 +0800
commit9e55b44b710f38c63a4bfd17d0b07318d5c68535 (patch)
treea2cc0c519b4327028d7b8f544ba5171fff2d8dc1 /src/main/java/me/shedaniel/rei/plugin/DefaultCustomDisplay.java
parentb7e018527db2e9cae2db4226f6af9fc34054c964 (diff)
downloadRoughlyEnoughItems-9e55b44b710f38c63a4bfd17d0b07318d5c68535.tar.gz
RoughlyEnoughItems-9e55b44b710f38c63a4bfd17d0b07318d5c68535.tar.bz2
RoughlyEnoughItems-9e55b44b710f38c63a4bfd17d0b07318d5c68535.zip
REI v2.3.1 (#40)
- API Changes - Updated Config Screen - Added Tipped Arrows Recipes - Updated Mappings - Added IRecipeHelper - Turning things to Optional - Removed Cheats button, now included with the new config button - Buttons for switching gamemodes / time / weather (default: off) [Maybe not in this update] - Clickable Labels - 3+ recipes at the same time - Fixed RecipeBaseWidget bad rendering when too big - Fixed #42 Patched up item deleting & cheating - Choose Page Dialog
Diffstat (limited to 'src/main/java/me/shedaniel/rei/plugin/DefaultCustomDisplay.java')
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/DefaultCustomDisplay.java70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultCustomDisplay.java b/src/main/java/me/shedaniel/rei/plugin/DefaultCustomDisplay.java
new file mode 100644
index 000000000..0920c78d8
--- /dev/null
+++ b/src/main/java/me/shedaniel/rei/plugin/DefaultCustomDisplay.java
@@ -0,0 +1,70 @@
+package me.shedaniel.rei.plugin;
+
+import com.google.common.collect.Lists;
+import net.minecraft.item.ItemStack;
+import net.minecraft.recipe.Recipe;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+
+public class DefaultCustomDisplay implements DefaultCraftingDisplay {
+
+ private List<List<ItemStack>> input;
+ private List<ItemStack> output;
+ private Recipe possibleRecipe;
+ private int width, height;
+
+ public DefaultCustomDisplay(List<List<ItemStack>> input, List<ItemStack> output, Recipe possibleRecipe) {
+ this.input = input;
+ this.output = output;
+ this.possibleRecipe = possibleRecipe;
+ List<Boolean> row = Lists.newArrayList(false, false, false);
+ List<Boolean> column = Lists.newArrayList(false, false, false);
+ for(int i = 0; i < 9; i++)
+ if (i < input.size()) {
+ List<ItemStack> stacks = input.get(i);
+ if (stacks.stream().filter(stack -> !stack.isEmpty()).count() > 0) {
+ row.set((i - (i % 3)) / 3, true);
+ column.set(i % 3, true);
+ }
+ }
+ width = (int) column.stream().filter(b -> b).count();
+ height = (int) row.stream().filter(b -> b).count();
+ }
+
+ public DefaultCustomDisplay(List<List<ItemStack>> input, List<ItemStack> output) {
+ this(input, output, null);
+ }
+
+ @Override
+ public Optional<Recipe> getRecipe() {
+ return Optional.ofNullable(possibleRecipe);
+ }
+
+ @Override
+ public List<List<ItemStack>> getInput() {
+ return Collections.unmodifiableList(input);
+ }
+
+ @Override
+ public List<ItemStack> getOutput() {
+ return Collections.unmodifiableList(output);
+ }
+
+ @Override
+ public List<List<ItemStack>> getRequiredItems() {
+ return Collections.unmodifiableList(input);
+ }
+
+ @Override
+ public int getWidth() {
+ return width;
+ }
+
+ @Override
+ public int getHeight() {
+ return height;
+ }
+
+}