aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/plugin/campfire
diff options
context:
space:
mode:
authorDanielshe <shekwancheung0528@gmail.com>2019-11-03 14:44:52 +0800
committerDanielshe <shekwancheung0528@gmail.com>2019-11-03 14:44:59 +0800
commit9f5a9eae9a7863412cc5eb433bf15e5ee71da616 (patch)
tree0e6b0b94af061c5e9023b1ff19f339a6c30149be /src/main/java/me/shedaniel/rei/plugin/campfire
parent3e3e25855b9f6df507a7d4c8a07c64b9a502fae2 (diff)
downloadRoughlyEnoughItems-9f5a9eae9a7863412cc5eb433bf15e5ee71da616.tar.gz
RoughlyEnoughItems-9f5a9eae9a7863412cc5eb433bf15e5ee71da616.tar.bz2
RoughlyEnoughItems-9f5a9eae9a7863412cc5eb433bf15e5ee71da616.zip
3.2.1
Diffstat (limited to 'src/main/java/me/shedaniel/rei/plugin/campfire')
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireCategory.java13
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireDisplay.java31
2 files changed, 25 insertions, 19 deletions
diff --git a/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireCategory.java b/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireCategory.java
index cccf8c688..f6bce7b51 100644
--- a/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireCategory.java
+++ b/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireCategory.java
@@ -8,11 +8,11 @@ package me.shedaniel.rei.plugin.campfire;
import me.shedaniel.math.api.Point;
import me.shedaniel.math.api.Rectangle;
import com.mojang.blaze3d.systems.RenderSystem;
+import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.RecipeCategory;
-import me.shedaniel.rei.api.Renderer;
+import me.shedaniel.rei.gui.widget.EntryWidget;
import me.shedaniel.rei.gui.widget.RecipeArrowWidget;
import me.shedaniel.rei.gui.widget.RecipeBaseWidget;
-import me.shedaniel.rei.gui.widget.SlotWidget;
import me.shedaniel.rei.gui.widget.Widget;
import me.shedaniel.rei.impl.ScreenHelper;
import me.shedaniel.rei.plugin.DefaultPlugin;
@@ -20,7 +20,6 @@ import net.minecraft.block.Blocks;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.GuiLighting;
import net.minecraft.client.resource.language.I18n;
-import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
@@ -37,8 +36,8 @@ public class DefaultCampfireCategory implements RecipeCategory<DefaultCampfireDi
}
@Override
- public Renderer getIcon() {
- return Renderer.fromItemStack(new ItemStack(Blocks.CAMPFIRE));
+ public EntryStack getLogo() {
+ return EntryStack.create(Blocks.CAMPFIRE);
}
@Override
@@ -65,8 +64,8 @@ public class DefaultCampfireCategory implements RecipeCategory<DefaultCampfireDi
}
}));
widgets.add(new RecipeArrowWidget(startPoint.x + 24, startPoint.y + 18, true));
- widgets.add(new SlotWidget(startPoint.x + 1, startPoint.y + 11, Renderer.fromItemStacks(recipeDisplaySupplier.get().getInput().get(0)), true, true, true));
- widgets.add(new SlotWidget(startPoint.x + 61, startPoint.y + 19, Renderer.fromItemStacks(recipeDisplaySupplier.get().getOutput()), false, true, true));
+ widgets.add(EntryWidget.create(startPoint.x + 1, startPoint.y + 11).entries(recipeDisplaySupplier.get().getInputEntries().get(0)));
+ widgets.add(EntryWidget.create(startPoint.x + 61, startPoint.y + 19).entries(recipeDisplaySupplier.get().getOutputEntries()).noBackground());
return widgets;
}
diff --git a/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireDisplay.java b/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireDisplay.java
index aca26283a..b3ed3e2f5 100644
--- a/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireDisplay.java
+++ b/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireDisplay.java
@@ -5,6 +5,7 @@
package me.shedaniel.rei.plugin.campfire;
+import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.RecipeDisplay;
import me.shedaniel.rei.plugin.DefaultPlugin;
import net.minecraft.item.ItemStack;
@@ -14,7 +15,7 @@ import net.minecraft.recipe.Ingredient;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.Identifier;
-import java.util.Arrays;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
@@ -22,8 +23,8 @@ import java.util.stream.Collectors;
public class DefaultCampfireDisplay implements RecipeDisplay {
- private List<List<ItemStack>> inputs;
- private List<ItemStack> output;
+ private List<List<EntryStack>> inputs;
+ private List<EntryStack> output;
private int cookTime;
private CampfireCookingRecipe display;
@@ -33,8 +34,14 @@ public class DefaultCampfireDisplay implements RecipeDisplay {
}
public DefaultCampfireDisplay(DefaultedList<Ingredient> ingredients, ItemStack output, int cookTime) {
- this.inputs = ingredients.stream().map(i -> Arrays.asList(i.getMatchingStacksClient())).collect(Collectors.toList());
- this.output = Collections.singletonList(output);
+ this.inputs = ingredients.stream().map(i -> {
+ List<EntryStack> entries = new ArrayList<>();
+ for (ItemStack stack : i.getStackArray()) {
+ entries.add(EntryStack.create(stack));
+ }
+ return entries;
+ }).collect(Collectors.toList());
+ this.output = Collections.singletonList(EntryStack.create(output));
this.cookTime = cookTime;
}
@@ -48,23 +55,23 @@ public class DefaultCampfireDisplay implements RecipeDisplay {
}
@Override
- public List<List<ItemStack>> getInput() {
+ public List<List<EntryStack>> getInputEntries() {
return inputs;
}
@Override
- public List<ItemStack> getOutput() {
- return this.output;
+ public List<EntryStack> getOutputEntries() {
+ return output;
}
@Override
- public Identifier getRecipeCategory() {
- return DefaultPlugin.CAMPFIRE;
+ public List<List<EntryStack>> getRequiredEntries() {
+ return inputs;
}
@Override
- public List<List<ItemStack>> getRequiredItems() {
- return getInput();
+ public Identifier getRecipeCategory() {
+ return DefaultPlugin.CAMPFIRE;
}
}