diff options
| author | Unknown <shekwancheung0528@gmail.com> | 2019-06-08 20:30:53 +0800 |
|---|---|---|
| committer | Unknown <shekwancheung0528@gmail.com> | 2019-06-08 20:30:53 +0800 |
| commit | 4710c557f449703362665a520bf68b85b2a7cdc1 (patch) | |
| tree | ed9555c626be11c7bc0d230d2b905856269bd916 | |
| parent | 28adfa726bcdb27eea4ffa39962c881d5c3d929b (diff) | |
| download | RoughlyEnoughItems-4710c557f449703362665a520bf68b85b2a7cdc1.tar.gz RoughlyEnoughItems-4710c557f449703362665a520bf68b85b2a7cdc1.tar.bz2 RoughlyEnoughItems-4710c557f449703362665a520bf68b85b2a7cdc1.zip | |
We are going to break lots of mods
32 files changed, 154 insertions, 265 deletions
@@ -0,0 +1,2 @@ +Roughly Enough Items by Danielshe. +Licensed under the MIT License.
\ No newline at end of file diff --git a/build.gradle b/build.gradle index 3c2680f73..18e0abe03 100755 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ plugins { id 'fabric-loom' version '0.2.2-SNAPSHOT' id 'maven-publish' + id 'net.minecrell.licenser' version '0.4.1' } sourceCompatibility = 1.8 @@ -17,6 +18,12 @@ def includeDep = true minecraft { } +license { + header rootProject.file('HEADER') + include '**/*.java' + exclude '**/Scissors.java' +} + repositories { maven { url "https://tehnut.info/maven/" } maven { url "https://oss.sonatype.org/content/repositories/snapshots" } @@ -75,14 +82,14 @@ publishing { } repositories { - if (project.hasProperty('danielshe_pass')) { - maven { - url = "http://deploy.modmuss50.me/" - credentials { - username = "danielshe" - password = project.getProperty('danielshe_pass') - } - } - } +// if (project.hasProperty('danielshe_pass')) { +// maven { +// url = "http://deploy.modmuss50.me/" +// credentials { +// username = "danielshe" +// password = project.getProperty('danielshe_pass') +// } +// } +// } } }
\ No newline at end of file diff --git a/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java b/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java index d77e2c9ab..26739d4cf 100644 --- a/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java +++ b/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java @@ -16,11 +16,6 @@ import java.util.Optional; public interface RecipeDisplay<T extends Recipe> { /** - * @return the optional recipe - */ - Optional<? extends Recipe> getRecipe(); - - /** * @return a list of items */ List<List<ItemStack>> getInput(); @@ -46,4 +41,13 @@ public interface RecipeDisplay<T extends Recipe> { */ Identifier getRecipeCategory(); + /** + * Gets the recipe location from datapack + * + * @return the recipe location + */ + default Optional<Identifier> getRecipeLocation() { + return Optional.empty(); + } + } diff --git a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java index ca0202d1f..19d411cfd 100644 --- a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java +++ b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java @@ -126,27 +126,20 @@ public interface RecipeHelper { void registerSpeedCraftButtonArea(Identifier category, ButtonAreaSupplier rectangle); /** - * @param category the category of the button area - * @deprecated Not required anymore - */ - @Deprecated - void registerDefaultSpeedCraftButtonArea(Identifier category); - - /** - * Gets the speed crafting functional from a category + * Removes the speed crafting button * - * @param category the category of the speed crafting functional - * @return the list of speed crafting functionals + * @param category the category of the button */ - List<SpeedCraftFunctional> getSpeedCraftFunctional(RecipeCategory category); + default void removeSpeedCraftButton(Identifier category) { + registerSpeedCraftButtonArea(category, bounds -> null); + } /** - * Registers a speed crafting functional - * - * @param category the category of the speed crafting functional - * @param functional the functional to be registered + * @param category the category of the button area + * @deprecated Not required anymore */ - void registerSpeedCraftFunctional(Identifier category, SpeedCraftFunctional functional); + @Deprecated + void registerDefaultSpeedCraftButtonArea(Identifier category); /** * Gets the map of all recipes visible to the player diff --git a/src/main/java/me/shedaniel/rei/api/SpeedCraftFunctional.java b/src/main/java/me/shedaniel/rei/api/SpeedCraftFunctional.java deleted file mode 100644 index 32f67438d..000000000 --- a/src/main/java/me/shedaniel/rei/api/SpeedCraftFunctional.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Roughly Enough Items by Danielshe. - * Licensed under the MIT License. - */ - -package me.shedaniel.rei.api; - -import net.minecraft.client.gui.screen.Screen; - -public interface SpeedCraftFunctional<T extends RecipeDisplay> { - - /** - * Gets the classes that it is functioning for - * - * @return the array of classes - */ - Class[] getFunctioningFor(); - - /** - * Performs the auto crafting - * - * @param screen the current screen - * @param recipe the current recipe - * @return whether it worked - */ - boolean performAutoCraft(Screen screen, T recipe); - - /** - * Gets if this functional accepts the auto crafting - * - * @param screen the current screen - * @param recipe the current recipe - * @return whether it is accepted - */ - boolean acceptRecipe(Screen screen, T recipe); - -} diff --git a/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java b/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java index 83ee91458..64450da02 100644 --- a/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java +++ b/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java @@ -43,7 +43,6 @@ public class RecipeHelperImpl implements RecipeHelper { private final Map<Identifier, DisplaySettings> categoryDisplaySettingsMap = Maps.newHashMap(); private final List<RecipeCategory> categories = Lists.newArrayList(); private final Map<Identifier, ButtonAreaSupplier> speedCraftAreaSupplierMap = Maps.newHashMap(); - private final Map<Identifier, List<SpeedCraftFunctional>> speedCraftFunctionalMap = Maps.newHashMap(); private final Map<Identifier, List<List<ItemStack>>> categoryWorkingStations = Maps.newHashMap(); private final List<DisplayVisibilityHandler> displayVisibilityHandlers = Lists.newArrayList(); private final List<LiveRecipeGenerator> liveRecipeGenerators = Lists.newArrayList(); @@ -211,20 +210,6 @@ public class RecipeHelperImpl implements RecipeHelper { registerSpeedCraftButtonArea(category, bounds -> new Rectangle((int) bounds.getMaxX() - 16, (int) bounds.getMaxY() - 16, 10, 10)); } - @Override - public List<SpeedCraftFunctional> getSpeedCraftFunctional(RecipeCategory category) { - if (speedCraftFunctionalMap.get(category.getIdentifier()) == null) - return Lists.newArrayList(); - return speedCraftFunctionalMap.get(category.getIdentifier()); - } - - @Override - public void registerSpeedCraftFunctional(Identifier category, SpeedCraftFunctional functional) { - List<SpeedCraftFunctional> list = speedCraftFunctionalMap.containsKey(category) ? new LinkedList<>(speedCraftFunctionalMap.get(category)) : Lists.newLinkedList(); - list.add(functional); - speedCraftFunctionalMap.put(category, list); - } - @SuppressWarnings("deprecation") public void recipesLoaded(RecipeManager recipeManager) { this.recipeCount.set(0); @@ -233,7 +218,6 @@ public class RecipeHelperImpl implements RecipeHelper { this.categories.clear(); this.speedCraftAreaSupplierMap.clear(); this.categoryWorkingStations.clear(); - this.speedCraftFunctionalMap.clear(); this.categoryDisplaySettingsMap.clear(); this.recipeFunctions.clear(); this.displayVisibilityHandlers.clear(); diff --git a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java index 4d0ec388a..6f3649952 100644 --- a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java +++ b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java @@ -16,7 +16,6 @@ import net.minecraft.ChatFormat; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.Element; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; import net.minecraft.client.render.GuiLighting; import net.minecraft.client.resource.language.I18n; import net.minecraft.client.sound.PositionedSoundInstance; @@ -70,14 +69,6 @@ public class RecipeViewingScreen extends Screen { this.choosePageActivated = false; } - public static SpeedCraftFunctional getSpeedCraftFunctionalByCategory(AbstractContainerScreen containerScreen, RecipeCategory category) { - for(SpeedCraftFunctional functional : RecipeHelper.getInstance().getSpeedCraftFunctional(category)) - for(Class aClass : functional.getFunctioningFor()) - if (containerScreen.getClass().isAssignableFrom(aClass)) - return functional; - return null; - } - @Override public boolean keyPressed(int int_1, int int_2, int int_3) { if (int_1 == 256 && choosePageActivated) { @@ -280,7 +271,6 @@ public class RecipeViewingScreen extends Screen { } } Optional<ButtonAreaSupplier> supplier = RecipeHelper.getInstance().getSpeedCraftButtonArea(selectedCategory); - final SpeedCraftFunctional functional = getSpeedCraftFunctionalByCategory(ScreenHelper.getLastContainerScreen(), selectedCategory); int recipeHeight = selectedCategory.getDisplayHeight(); List<RecipeDisplay> currentDisplayed = getCurrentDisplayed(); for(int i = 0; i < currentDisplayed.size(); i++) { @@ -290,7 +280,7 @@ public class RecipeViewingScreen extends Screen { final Rectangle displayBounds = new Rectangle((int) getBounds().getCenterX() - displayWidth / 2, getBounds().y + 40 + recipeHeight * i + 7 * i, displayWidth, recipeHeight); widgets.addAll(selectedCategory.setupDisplay(displaySupplier, displayBounds)); if (supplier.isPresent()) - widgets.add(new SpeedCraftingButtonWidget(supplier.get().get(displayBounds), supplier.get().getButtonText(), functional, displaySupplier)); + widgets.add(new AutoCraftingButtonWidget(supplier.get().get(displayBounds), supplier.get().getButtonText(), displaySupplier)); } if (choosePageActivated) recipeChoosePageWidget = new RecipeChoosePageWidget(this, page, getTotalPages(selectedCategory)); diff --git a/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java index 6a39f06d9..f6958c5be 100644 --- a/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java +++ b/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java @@ -38,8 +38,6 @@ import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; -import static me.shedaniel.rei.gui.RecipeViewingScreen.getSpeedCraftFunctionalByCategory; - public class VillagerRecipeViewingScreen extends Screen { private static final int TABS_PER_PAGE = 8; @@ -132,9 +130,8 @@ public class VillagerRecipeViewingScreen extends Screen { Rectangle recipeBounds = new Rectangle(bounds.x + 100 + (guiWidth - 100) / 2 - category.getDisplayWidth(display) / 2, bounds.y + bounds.height / 2 - category.getDisplayHeight() / 2, category.getDisplayWidth(display), category.getDisplayHeight()); this.widgets.addAll(category.setupDisplay(() -> display, recipeBounds)); Optional<ButtonAreaSupplier> supplier = RecipeHelper.getInstance().getSpeedCraftButtonArea(category); - final SpeedCraftFunctional functional = getSpeedCraftFunctionalByCategory(ScreenHelper.getLastContainerScreen(), category); if (supplier.isPresent() && supplier.get().get(recipeBounds) != null) - this.widgets.add(new SpeedCraftingButtonWidget(supplier.get().get(recipeBounds), supplier.get().getButtonText(), functional, () -> display)); + this.widgets.add(new AutoCraftingButtonWidget(supplier.get().get(recipeBounds), supplier.get().getButtonText(), () -> display)); int index = 0; for(RecipeDisplay recipeDisplay : categoryMap.get(category)) { diff --git a/src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java b/src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java index e54a37581..8a5ba8211 100644 --- a/src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java +++ b/src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java @@ -5,14 +5,22 @@ package me.shedaniel.rei.gui.credits; +import com.google.common.collect.Lists; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import me.shedaniel.rei.client.ScreenHelper; import me.shedaniel.rei.gui.credits.CreditsEntryListWidget.CreditsItem; +import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; import net.minecraft.client.gui.widget.AbstractPressableButtonWidget; import net.minecraft.client.resource.language.I18n; import net.minecraft.network.chat.TextComponent; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + public class CreditsScreen extends Screen { private Screen parent; @@ -39,7 +47,30 @@ public class CreditsScreen extends Screen { protected void init() { children.add(entryListWidget = new CreditsEntryListWidget(minecraft, width, height, 32, height - 32)); entryListWidget.creditsClearEntries(); - for(String line : I18n.translate("text.rei.credit.text").split("\n")) + List<String> translators = Lists.newArrayList(); + FabricLoader.getInstance().getModContainer("roughlyenoughitems").ifPresent(rei -> { + try { + if (rei.getMetadata().containsCustomElement("rei:translators")) { + JsonObject jsonObject = rei.getMetadata().getCustomElement("rei:translators").getAsJsonObject(); + for(Map.Entry<String, JsonElement> entry : jsonObject.entrySet()) { + JsonElement value = entry.getValue(); + String behind = value.isJsonArray() ? Lists.newArrayList(value.getAsJsonArray().iterator()).stream().map(json -> json.getAsString()).sorted(String::compareToIgnoreCase).collect(Collectors.joining(", ")) : value.getAsString(); + translators.add(String.format(" %s - %s", entry.getKey(), behind)); + } + } + translators.sort(String::compareToIgnoreCase); + } catch (Exception e) { + translators.clear(); + translators.add("Failed to get translators: " + e.toString()); + for(StackTraceElement traceElement : e.getStackTrace()) + translators.add(" at " + traceElement); + e.printStackTrace(); + } + }); + List<String> actualTranslators = Lists.newArrayList(); + int i = width - 80 - 6; + translators.forEach(s -> font.wrapStringToWidthAsList(s, i).forEach(actualTranslators::add)); + for(String line : I18n.translate("text.rei.credit.text", FabricLoader.getInstance().getModContainer("roughlyenoughitems").map(mod -> mod.getMetadata().getVersion().getFriendlyString()).orElse("Unknown"), String.join("\n", actualTranslators)).split("\n")) entryListWidget.creditsAddEntry(new CreditsItem(new TextComponent(line))); entryListWidget.creditsAddEntry(new CreditsItem(new TextComponent(""))); children.add(buttonDone = new AbstractPressableButtonWidget(width / 2 - 100, height - 26, 200, 20, I18n.translate("gui.done")) { diff --git a/src/main/java/me/shedaniel/rei/gui/widget/SpeedCraftingButtonWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/AutoCraftingButtonWidget.java index f2049919d..d62ac654f 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/SpeedCraftingButtonWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/AutoCraftingButtonWidget.java @@ -6,40 +6,39 @@ package me.shedaniel.rei.gui.widget; import me.shedaniel.rei.api.RecipeDisplay; -import me.shedaniel.rei.api.SpeedCraftFunctional; import me.shedaniel.rei.client.ScreenHelper; import net.minecraft.ChatFormat; +import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; import net.minecraft.client.resource.language.I18n; -import net.minecraft.recipe.Recipe; +import net.minecraft.util.Identifier; import java.awt.*; import java.util.Optional; import java.util.function.Supplier; -public class SpeedCraftingButtonWidget extends ButtonWidget { +public class AutoCraftingButtonWidget extends ButtonWidget { private final Supplier<RecipeDisplay> displaySupplier; - private final SpeedCraftFunctional functional; private String extraTooltip; + private AbstractContainerScreen containerScreen; - public SpeedCraftingButtonWidget(Rectangle rectangle, String text, SpeedCraftFunctional functional, Supplier<RecipeDisplay> displaySupplier) { + public AutoCraftingButtonWidget(Rectangle rectangle, String text, Supplier<RecipeDisplay> displaySupplier) { super(rectangle, text); this.displaySupplier = displaySupplier; - this.functional = functional; - Optional<Recipe> recipe = displaySupplier.get().getRecipe(); - extraTooltip = recipe.isPresent() ? I18n.translate("text.rei.recipe_id", ChatFormat.GRAY.toString(), recipe.get().getId().toString()) : ""; + Optional<Identifier> recipe = displaySupplier.get().getRecipeLocation(); + extraTooltip = recipe.isPresent() ? I18n.translate("text.rei.recipe_id", ChatFormat.GRAY.toString(), recipe.get().toString()) : ""; + this.containerScreen = ScreenHelper.getLastContainerScreen(); } @Override public void onPressed() { - minecraft.openScreen(ScreenHelper.getLastContainerScreen()); + minecraft.openScreen(containerScreen); ScreenHelper.getLastOverlay().init(); - functional.performAutoCraft(ScreenHelper.getLastContainerScreen(), displaySupplier.get()); } @Override public void render(int mouseX, int mouseY, float delta) { - this.enabled = functional != null && functional.acceptRecipe(ScreenHelper.getLastContainerScreen(), displaySupplier.get()); + this.enabled = true; super.render(mouseX, mouseY, delta); } @@ -47,12 +46,12 @@ public class SpeedCraftingButtonWidget extends ButtonWidget { public Optional<String> getTooltips() { if (this.minecraft.options.advancedItemTooltips) if (enabled) - return Optional.ofNullable(I18n.translate("text.speed_craft.move_items") + extraTooltip); + return Optional.ofNullable(I18n.translate("text.auto_craft.move_items") + extraTooltip); else - return Optional.ofNullable(I18n.translate("text.speed_craft.failed_move_items") + extraTooltip); + return Optional.ofNullable(I18n.translate("text.auto_craft.failed_move_items") + extraTooltip); if (enabled) - return Optional.ofNullable(I18n.translate("text.speed_craft.move_items")); + return Optional.ofNullable(I18n.translate("text.auto_craft.move_items")); else - return Optional.ofNullable(I18n.translate("text.speed_craft.failed_move_items")); + return Optional.ofNullable(I18n.translate("text.auto_craft.failed_move_items")); } } diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultBlastingDisplay.java b/src/main/java/me/shedaniel/rei/plugin/DefaultBlastingDisplay.java index 3adab1d6f..6e490c47c 100644 --- a/src/main/java/me/shedaniel/rei/plugin/DefaultBlastingDisplay.java +++ b/src/main/java/me/shedaniel/rei/plugin/DefaultBlastingDisplay.java @@ -9,6 +9,7 @@ import me.shedaniel.rei.api.RecipeDisplay; import net.minecraft.block.entity.FurnaceBlockEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.recipe.AbstractCookingRecipe; import net.minecraft.recipe.BlastingRecipe; import net.minecraft.util.Identifier; @@ -32,8 +33,8 @@ public class DefaultBlastingDisplay implements RecipeDisplay<BlastingRecipe> { } @Override - public Optional<BlastingRecipe> getRecipe() { - return Optional.ofNullable(display); + public Optional<Identifier> getRecipeLocation() { + return Optional.ofNullable(display).map(AbstractCookingRecipe::getId); } @Override diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultBrewingDisplay.java b/src/main/java/me/shedaniel/rei/plugin/DefaultBrewingDisplay.java index 792b3a78d..80c49b53e 100644 --- a/src/main/java/me/shedaniel/rei/plugin/DefaultBrewingDisplay.java +++ b/src/main/java/me/shedaniel/rei/plugin/DefaultBrewingDisplay.java @@ -10,10 +10,12 @@ import me.shedaniel.rei.api.RecipeDisplay; import net.minecraft.block.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.recipe.Ingredient; -import net.minecraft.recipe.Recipe; import net.minecraft.util.Identifier; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; public class DefaultBrewingDisplay implements RecipeDisplay { @@ -27,11 +29,6 @@ public class DefaultBrewingDisplay implements RecipeDisplay { } @Override - public Optional<Recipe> getRecipe() { - return Optional.empty(); - } - - @Override public List<List<ItemStack>> getInput() { return Lists.newArrayList(Collections.singletonList(input), Arrays.asList(reactant.getStackArray())); } diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultCampfireDisplay.java b/src/main/java/me/shedaniel/rei/plugin/DefaultCampfireDisplay.java index 4e910be9e..86ab7a26a 100644 --- a/src/main/java/me/shedaniel/rei/plugin/DefaultCampfireDisplay.java +++ b/src/main/java/me/shedaniel/rei/plugin/DefaultCampfireDisplay.java @@ -7,6 +7,7 @@ package me.shedaniel.rei.plugin; import me.shedaniel.rei.api.RecipeDisplay; import net.minecraft.item.ItemStack; +import net.minecraft.recipe.AbstractCookingRecipe; import net.minecraft.recipe.CampfireCookingRecipe; import net.minecraft.recipe.Ingredient; import net.minecraft.util.DefaultedList; @@ -41,8 +42,8 @@ public class DefaultCampfireDisplay implements RecipeDisplay<CampfireCookingReci } @Override - public Optional<CampfireCookingRecipe> getRecipe() { - return Optional.ofNullable(display); + public Optional<Identifier> getRecipeLocation() { + return Optional.ofNullable(display).map(AbstractCookingRecipe::getId); } @Override diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultCompostingDisplay.java b/src/main/java/me/shedaniel/rei/plugin/DefaultCompostingDisplay.java index 235bbcd06..e61e59268 100644 --- a/src/main/java/me/shedaniel/rei/plugin/DefaultCompostingDisplay.java +++ b/src/main/java/me/shedaniel/rei/plugin/DefaultCompostingDisplay.java @@ -9,7 +9,6 @@ import me.shedaniel.rei.api.RecipeDisplay; import net.minecraft.item.Item; import net.minecraft.item.ItemConvertible; import net.minecraft.item.ItemStack; -import net.minecraft.recipe.Recipe; import net.minecraft.util.Identifier; import java.util.*; @@ -35,11 +34,6 @@ public class DefaultCompostingDisplay implements RecipeDisplay { } @Override - public Optional<Recipe> getRecipe() { - return Optional.empty(); - } - - @Override public List<List<ItemStack>> getInput() { List<List<ItemStack>> lists = new ArrayList<>(); allItems.stream().forEachOrdered(itemProvider -> { diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultCustomDisplay.java b/src/main/java/me/shedaniel/rei/plugin/DefaultCustomDisplay.java index 21c141906..1a434e2f4 100644 --- a/src/main/java/me/shedaniel/rei/plugin/DefaultCustomDisplay.java +++ b/src/main/java/me/shedaniel/rei/plugin/DefaultCustomDisplay.java @@ -8,6 +8,7 @@ package me.shedaniel.rei.plugin; import com.google.common.collect.Lists; import net.minecraft.item.ItemStack; import net.minecraft.recipe.Recipe; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Optional; @@ -41,9 +42,13 @@ public class DefaultCustomDisplay implements DefaultCraftingDisplay { this(input, output, null); } + public Recipe getPossibleRecipe() { + return possibleRecipe; + } + @Override - public Optional<Recipe> getRecipe() { - return Optional.ofNullable(possibleRecipe); + public Optional<Identifier> getRecipeLocation() { + return Optional.ofNullable(possibleRecipe).map(Recipe::getId); } @Override diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java b/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java index c04aba51a..243a12b89 100644 --- a/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java +++ b/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java @@ -13,11 +13,10 @@ import me.shedaniel.rei.client.ScreenHelper; import me.shedaniel.rei.gui.RecipeViewingScreen; |
