From f0ab36740da2047d6cd86bc4769972cba2ea025b Mon Sep 17 00:00:00 2001 From: TheRealWormbo Date: Sun, 28 Jul 2024 22:34:00 +0200 Subject: [PATCH] Fix errors in REI integration --- .../integration/rei/BotaniaREIPlugin.java | 27 ++++++++++--------- .../integration/rei/BotaniaRecipeDisplay.java | 11 ++++---- .../integration/rei/BreweryREIDisplay.java | 9 ++++--- .../integration/rei/ElvenTradeREIDisplay.java | 6 +++-- .../integration/rei/ManaPoolREIDisplay.java | 10 ++++--- .../rei/MarimorphosisREICategory.java | 25 ----------------- .../rei/MarimorphosisREIDisplay.java | 8 +++--- .../rei/OrechidBaseREIDisplay.java | 14 +++++----- .../rei/OrechidIgnemREIDisplay.java | 8 +++--- .../integration/rei/OrechidREICategory.java | 20 +++++++------- .../integration/rei/OrechidREIDisplay.java | 8 +++--- .../rei/PetalApothecaryREIDisplay.java | 10 ++++--- .../integration/rei/PureDaisyREIDisplay.java | 19 +++++++++---- .../rei/RunicAltarREICategory.java | 4 ++- .../integration/rei/RunicAltarREIDisplay.java | 19 ++++++++++--- .../TerrestrialAgglomerationREIDisplay.java | 6 +++-- gradle.properties | 2 +- 17 files changed, 113 insertions(+), 93 deletions(-) delete mode 100644 Fabric/src/main/java/vazkii/botania/fabric/integration/rei/MarimorphosisREICategory.java diff --git a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/BotaniaREIPlugin.java b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/BotaniaREIPlugin.java index 245e86b66f..808676fc86 100644 --- a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/BotaniaREIPlugin.java +++ b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/BotaniaREIPlugin.java @@ -34,16 +34,18 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.RecipeHolder; import net.minecraft.world.level.block.Block; import org.jetbrains.annotations.Nullable; import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.item.AncientWillContainer; +import vazkii.botania.api.recipe.*; import vazkii.botania.client.core.handler.CorporeaInputHandler; import vazkii.botania.common.block.BotaniaBlocks; import vazkii.botania.common.block.BotaniaFlowerBlocks; -import vazkii.botania.common.crafting.*; +import vazkii.botania.common.crafting.BotaniaRecipeTypes; import vazkii.botania.common.item.AncientWillItem; import vazkii.botania.common.item.BotaniaItems; import vazkii.botania.common.item.equipment.tool.terrasteel.TerraShattererItem; @@ -78,7 +80,7 @@ public void registerCategories(CategoryRegistry helper) { new TerrestrialAgglomerationREICategory(), new OrechidREICategory(BotaniaREICategoryIdentifiers.ORECHID, BotaniaFlowerBlocks.orechid), new OrechidREICategory(BotaniaREICategoryIdentifiers.ORECHID_IGNEM, BotaniaFlowerBlocks.orechidIgnem), - new MarimorphosisREICategory() + new OrechidREICategory(BotaniaREICategoryIdentifiers.MARIMORPHOSIS, BotaniaFlowerBlocks.marimorphosis) )); helper.addWorkstations(BuiltinPlugin.CRAFTING, EntryStacks.of(BotaniaItems.craftingHalo), EntryStacks.of(BotaniaItems.autocraftingHalo)); @@ -121,15 +123,14 @@ public void registerDisplays(DisplayRegistry helper) { registerCompositeLensRecipeWrapper(helper); registerTerraPickTippingRecipeWrapper(helper); - helper.registerFiller(PetalApothecaryRecipe.class, PetalApothecaryREIDisplay::new); - helper.registerFiller(BotanicalBreweryRecipe.class, BreweryREIDisplay::new); - Predicate pred = recipe -> !recipe.isReturnRecipe(); - helper.registerFiller(ElvenTradeRecipe.class, pred, ElvenTradeREIDisplay::new); - helper.registerFiller(LexiconElvenTradeRecipe.class, ElvenTradeREIDisplay::new); - helper.registerFiller(ManaInfusionRecipe.class, ManaPoolREIDisplay::new); - helper.registerFiller(PureDaisyRecipe.class, PureDaisyREIDisplay::new); - helper.registerFiller(RunicAltarRecipe.class, RunicAltarREIDisplay::new); - helper.registerFiller(TerrestrialAgglomerationRecipe.class, TerrestrialAgglomerationREIDisplay::new); + helper.registerRecipeFiller(PetalApothecaryRecipe.class, BotaniaRecipeTypes.PETAL_TYPE, PetalApothecaryREIDisplay::new); + helper.registerRecipeFiller(BotanicalBreweryRecipe.class, BotaniaRecipeTypes.BREW_TYPE, BreweryREIDisplay::new); + Predicate> pred = recipe -> !recipe.value().isReturnRecipe(); + helper.registerRecipeFiller(ElvenTradeRecipe.class, BotaniaRecipeTypes.ELVEN_TRADE_TYPE::equals, pred, ElvenTradeREIDisplay::new); + helper.registerRecipeFiller(ManaInfusionRecipe.class, BotaniaRecipeTypes.MANA_INFUSION_TYPE, ManaPoolREIDisplay::new); + helper.registerRecipeFiller(PureDaisyRecipe.class, BotaniaRecipeTypes.PURE_DAISY_TYPE, PureDaisyREIDisplay::new); + helper.registerRecipeFiller(RunicAltarRecipe.class, BotaniaRecipeTypes.RUNE_TYPE, RunicAltarREIDisplay::new); + helper.registerRecipeFiller(TerrestrialAgglomerationRecipe.class, BotaniaRecipeTypes.TERRA_PLATE_TYPE, TerrestrialAgglomerationREIDisplay::new); try { for (var entry : FabricXplatImpl.CUSTOM_STRIPPING.entrySet()) { @@ -141,9 +142,9 @@ public void registerDisplays(DisplayRegistry helper) { helper.registerRecipeFiller(OrechidRecipe.class, BotaniaRecipeTypes.ORECHID_TYPE, OrechidREIDisplay::new); - helper.registerRecipeFiller(OrechidIgnemRecipe.class, BotaniaRecipeTypes.ORECHID_IGNEM_TYPE, + helper.registerRecipeFiller(OrechidRecipe.class, BotaniaRecipeTypes.ORECHID_IGNEM_TYPE, OrechidIgnemREIDisplay::new); - helper.registerRecipeFiller(MarimorphosisRecipe.class, BotaniaRecipeTypes.MARIMORPHOSIS_TYPE, + helper.registerRecipeFiller(OrechidRecipe.class, BotaniaRecipeTypes.MARIMORPHOSIS_TYPE, MarimorphosisREIDisplay::new); } diff --git a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/BotaniaRecipeDisplay.java b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/BotaniaRecipeDisplay.java index 9e493eb675..927c32af6a 100644 --- a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/BotaniaRecipeDisplay.java +++ b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/BotaniaRecipeDisplay.java @@ -16,6 +16,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.Container; import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeHolder; import org.jetbrains.annotations.NotNull; @@ -24,15 +25,15 @@ import java.util.Optional; public abstract class BotaniaRecipeDisplay> implements Display { - protected final T recipe; + protected final RecipeHolder recipe; protected List inputs; protected EntryIngredient outputs; - public BotaniaRecipeDisplay(T recipe) { + public BotaniaRecipeDisplay(RecipeHolder recipe) { this.recipe = recipe; - this.inputs = EntryIngredients.ofIngredients(recipe.getIngredients()); + this.inputs = EntryIngredients.ofIngredients(recipe.value().getIngredients()); // TODO 1.19.4 figure out the proper way to get a registry access - this.outputs = EntryIngredients.of(recipe.getResultItem(RegistryAccess.EMPTY)); + this.outputs = EntryIngredients.of(recipe.value().getResultItem(RegistryAccess.EMPTY)); } @Override @@ -49,6 +50,6 @@ public BotaniaRecipeDisplay(T recipe) { @Override public @NotNull Optional getDisplayLocation() { - return Optional.ofNullable(this.recipe).map(T::getId); + return Optional.ofNullable(this.recipe).map(RecipeHolder::id); } } diff --git a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/BreweryREIDisplay.java b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/BreweryREIDisplay.java index 77f0fa2561..403771f220 100644 --- a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/BreweryREIDisplay.java +++ b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/BreweryREIDisplay.java @@ -13,10 +13,11 @@ import me.shedaniel.rei.api.common.util.EntryIngredients; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.RecipeHolder; import org.jetbrains.annotations.NotNull; -import vazkii.botania.common.crafting.BotanicalBreweryRecipe; +import vazkii.botania.api.recipe.BotanicalBreweryRecipe; import vazkii.botania.common.item.BotaniaItems; import java.util.ArrayList; @@ -26,13 +27,13 @@ public class BreweryREIDisplay extends BotaniaRecipeDisplay { private final EntryIngredient containers; - public BreweryREIDisplay(BotanicalBreweryRecipe recipe) { + public BreweryREIDisplay(RecipeHolder recipe) { super(recipe); List items = Arrays.asList(new ItemStack(BotaniaItems.vial), new ItemStack(BotaniaItems.flask), new ItemStack(BotaniaItems.incenseStick), new ItemStack(BotaniaItems.bloodPendant)); this.containers = EntryIngredients.ofItemStacks(items); List outputs = new ArrayList<>(); for (ItemStack stack : items) { - ItemStack brewed = recipe.getOutput(stack); + ItemStack brewed = recipe.value().getOutput(stack); if (!brewed.isEmpty()) { outputs.add(brewed); } @@ -46,7 +47,7 @@ public EntryIngredient getContainers() { @Override public int getManaCost() { - return recipe.getManaUsage(); + return recipe.value().getManaUsage(); } @Override diff --git a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/ElvenTradeREIDisplay.java b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/ElvenTradeREIDisplay.java index bd881b9a7a..6aad994f81 100644 --- a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/ElvenTradeREIDisplay.java +++ b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/ElvenTradeREIDisplay.java @@ -11,6 +11,8 @@ import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.util.EntryIngredients; +import net.minecraft.world.item.crafting.RecipeHolder; + import org.jetbrains.annotations.NotNull; import vazkii.botania.api.recipe.ElvenTradeRecipe; @@ -18,9 +20,9 @@ public class ElvenTradeREIDisplay extends BotaniaRecipeDisplay { - public ElvenTradeREIDisplay(ElvenTradeRecipe recipe) { + public ElvenTradeREIDisplay(RecipeHolder recipe) { super(recipe); - this.outputs = EntryIngredients.ofItemStacks(recipe.getOutputs()); + this.outputs = EntryIngredients.ofItemStacks(recipe.value().getOutputs()); } @Override diff --git a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/ManaPoolREIDisplay.java b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/ManaPoolREIDisplay.java index 9b93d87696..395a858876 100644 --- a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/ManaPoolREIDisplay.java +++ b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/ManaPoolREIDisplay.java @@ -10,19 +10,21 @@ import me.shedaniel.rei.api.common.category.CategoryIdentifier; +import net.minecraft.world.item.crafting.RecipeHolder; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import vazkii.botania.api.recipe.ManaInfusionRecipe; import vazkii.botania.api.recipe.StateIngredient; -import vazkii.botania.common.crafting.ManaInfusionRecipe; public class ManaPoolREIDisplay extends BotaniaRecipeDisplay { @Nullable private final StateIngredient catalyst; - public ManaPoolREIDisplay(ManaInfusionRecipe recipe) { + public ManaPoolREIDisplay(RecipeHolder recipe) { super(recipe); - this.catalyst = recipe.getRecipeCatalyst(); + this.catalyst = recipe.value().getRecipeCatalyst(); } @Nullable @@ -32,7 +34,7 @@ public StateIngredient getCatalyst() { @Override public int getManaCost() { - return recipe.getManaToConsume(); + return recipe.value().getManaToConsume(); } @Override diff --git a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/MarimorphosisREICategory.java b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/MarimorphosisREICategory.java deleted file mode 100644 index 55bc70f46b..0000000000 --- a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/MarimorphosisREICategory.java +++ /dev/null @@ -1,25 +0,0 @@ -package vazkii.botania.fabric.integration.rei; - -import net.minecraft.network.chat.Component; - -import org.jetbrains.annotations.NotNull; - -import vazkii.botania.api.recipe.OrechidRecipe; -import vazkii.botania.client.integration.shared.OrechidUIHelper; -import vazkii.botania.common.block.BotaniaFlowerBlocks; - -import java.util.stream.Stream; - -public class MarimorphosisREICategory extends OrechidREICategory { - public MarimorphosisREICategory() { - super(BotaniaREICategoryIdentifiers.MARIMORPHOSIS, BotaniaFlowerBlocks.marimorphosis); - } - - @NotNull - @Override - protected Stream getChanceTooltipComponents(double chance, OrechidRecipe recipe) { - Stream genericChanceTooltipComponents = super.getChanceTooltipComponents(chance, recipe); - Stream biomeChanceTooltipComponents = OrechidUIHelper.getBiomeChanceAndRatioTooltipComponents(chance, recipe); - return Stream.concat(genericChanceTooltipComponents, biomeChanceTooltipComponents); - } -} diff --git a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/MarimorphosisREIDisplay.java b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/MarimorphosisREIDisplay.java index 6148949839..186cc9af71 100644 --- a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/MarimorphosisREIDisplay.java +++ b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/MarimorphosisREIDisplay.java @@ -10,10 +10,12 @@ import me.shedaniel.rei.api.common.category.CategoryIdentifier; -import vazkii.botania.common.crafting.MarimorphosisRecipe; +import net.minecraft.world.item.crafting.RecipeHolder; -public class MarimorphosisREIDisplay extends OrechidBaseREIDisplay { - public MarimorphosisREIDisplay(MarimorphosisRecipe recipe) { +import vazkii.botania.api.recipe.OrechidRecipe; + +public class MarimorphosisREIDisplay extends OrechidBaseREIDisplay { + public MarimorphosisREIDisplay(RecipeHolder recipe) { super(recipe); } diff --git a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/OrechidBaseREIDisplay.java b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/OrechidBaseREIDisplay.java index 35db5c534f..f83a74d17f 100644 --- a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/OrechidBaseREIDisplay.java +++ b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/OrechidBaseREIDisplay.java @@ -12,6 +12,8 @@ import me.shedaniel.rei.api.common.entry.EntryIngredient; import me.shedaniel.rei.api.common.util.EntryStacks; +import net.minecraft.world.item.crafting.RecipeHolder; + import org.jetbrains.annotations.NotNull; import vazkii.botania.api.recipe.OrechidRecipe; @@ -20,14 +22,14 @@ import java.util.List; import java.util.stream.Collectors; -public abstract class OrechidBaseREIDisplay implements Display { +public abstract class OrechidBaseREIDisplay implements Display { private final List stone; private final List ores; - private final T recipe; + private final RecipeHolder recipe; - public OrechidBaseREIDisplay(T recipe) { - stone = Collections.singletonList(EntryIngredient.of(recipe.getInput().getDisplayedStacks().stream().map(EntryStacks::of).collect(Collectors.toList()))); - ores = Collections.singletonList(EntryIngredient.of(recipe.getOutput().getDisplayedStacks().stream().map(EntryStacks::of).collect(Collectors.toList()))); + public OrechidBaseREIDisplay(RecipeHolder recipe) { + stone = Collections.singletonList(EntryIngredient.of(recipe.value().getInput().getDisplayedStacks().stream().map(EntryStacks::of).collect(Collectors.toList()))); + ores = Collections.singletonList(EntryIngredient.of(recipe.value().getOutput().getDisplayedStacks().stream().map(EntryStacks::of).collect(Collectors.toList()))); this.recipe = recipe; } @@ -41,7 +43,7 @@ public OrechidBaseREIDisplay(T recipe) { return ores; } - public T getRecipe() { + public RecipeHolder getRecipe() { return recipe; } } diff --git a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/OrechidIgnemREIDisplay.java b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/OrechidIgnemREIDisplay.java index dc71e11bd5..c37de61f1b 100644 --- a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/OrechidIgnemREIDisplay.java +++ b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/OrechidIgnemREIDisplay.java @@ -10,12 +10,14 @@ import me.shedaniel.rei.api.common.category.CategoryIdentifier; +import net.minecraft.world.item.crafting.RecipeHolder; + import org.jetbrains.annotations.NotNull; -import vazkii.botania.common.crafting.OrechidIgnemRecipe; +import vazkii.botania.api.recipe.OrechidRecipe; -public class OrechidIgnemREIDisplay extends OrechidBaseREIDisplay { - public OrechidIgnemREIDisplay(OrechidIgnemRecipe recipe) { +public class OrechidIgnemREIDisplay extends OrechidBaseREIDisplay { + public OrechidIgnemREIDisplay(RecipeHolder recipe) { super(recipe); } diff --git a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/OrechidREICategory.java b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/OrechidREICategory.java index e73a199317..b977a0420c 100644 --- a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/OrechidREICategory.java +++ b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/OrechidREICategory.java @@ -35,19 +35,19 @@ import static vazkii.botania.fabric.integration.rei.PureDaisyREICategory.setupPureDaisyDisplay; -public class OrechidREICategory implements DisplayCategory> { +public class OrechidREICategory implements DisplayCategory { private final EntryStack orechid; - private final CategoryIdentifier> categoryId; + private final CategoryIdentifier categoryId; private final String langKey; - public OrechidREICategory(CategoryIdentifier> categoryId, Block orechid) { + public OrechidREICategory(CategoryIdentifier categoryId, Block orechid) { this.categoryId = categoryId; this.orechid = EntryStacks.of(orechid); this.langKey = "botania.nei." + (orechid == BotaniaFlowerBlocks.orechidIgnem ? "orechidIgnem" : "orechid"); } @Override - public @NotNull CategoryIdentifier> getCategoryIdentifier() { + public @NotNull CategoryIdentifier getCategoryIdentifier() { return categoryId; } @@ -62,16 +62,16 @@ public OrechidREICategory(CategoryIdentifier> } @Override - public @NotNull List setupDisplay(OrechidBaseREIDisplay display, Rectangle bounds) { + public @NotNull List setupDisplay(OrechidBaseREIDisplay display, Rectangle bounds) { List widgets = setupPureDaisyDisplay(display, bounds, orechid); - final Double chance = getChance(display.getRecipe()); + final Double chance = getChance(display.getRecipe().value()); if (chance != null) { final Component chanceComponent = OrechidUIHelper.getPercentageComponent(chance); final Point center = new Point(bounds.getCenterX() - 8, bounds.getCenterY() - 9); final Label chanceLabel = Widgets.createLabel(new Point(center.x + 51, center.y - 11), chanceComponent) .rightAligned().color(0x555555, 0xAAAAAA).noShadow(); - chanceLabel.tooltip(getChanceTooltipComponents(chance, display.getRecipe()).toArray(Component[]::new)); + chanceLabel.tooltip(getChanceTooltipComponents(chance, display.getRecipe().value()).toArray(Component[]::new)); widgets.add(chanceLabel); } @@ -81,7 +81,9 @@ public OrechidREICategory(CategoryIdentifier> @NotNull protected Stream getChanceTooltipComponents(double chance, OrechidRecipe recipe) { final var ratio = OrechidUIHelper.getRatioForChance(chance); - return Stream.of(OrechidUIHelper.getRatioTooltipComponent(ratio)); + Stream genericChanceTooltipComponents = Stream.of(OrechidUIHelper.getRatioTooltipComponent(ratio)); + Stream biomeChanceTooltipComponents = OrechidUIHelper.getBiomeChanceAndRatioTooltipComponents(chance, recipe); + return Stream.concat(genericChanceTooltipComponents, biomeChanceTooltipComponents); } @Nullable @@ -95,7 +97,7 @@ public int getDisplayHeight() { } @Override - public int getDisplayWidth(OrechidBaseREIDisplay display) { + public int getDisplayWidth(OrechidBaseREIDisplay display) { return 112; } } diff --git a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/OrechidREIDisplay.java b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/OrechidREIDisplay.java index 2370bc9a0c..7202a609c1 100644 --- a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/OrechidREIDisplay.java +++ b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/OrechidREIDisplay.java @@ -10,13 +10,15 @@ import me.shedaniel.rei.api.common.category.CategoryIdentifier; +import net.minecraft.world.item.crafting.RecipeHolder; + import org.jetbrains.annotations.NotNull; -import vazkii.botania.common.crafting.OrechidRecipe; +import vazkii.botania.api.recipe.OrechidRecipe; -public class OrechidREIDisplay extends OrechidBaseREIDisplay { +public class OrechidREIDisplay extends OrechidBaseREIDisplay { - public OrechidREIDisplay(OrechidRecipe recipe) { + public OrechidREIDisplay(RecipeHolder recipe) { super(recipe); } diff --git a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/PetalApothecaryREIDisplay.java b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/PetalApothecaryREIDisplay.java index 22f0f40618..ee26e290a3 100644 --- a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/PetalApothecaryREIDisplay.java +++ b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/PetalApothecaryREIDisplay.java @@ -12,16 +12,18 @@ import me.shedaniel.rei.api.common.entry.EntryIngredient; import me.shedaniel.rei.api.common.util.EntryIngredients; +import net.minecraft.world.item.crafting.RecipeHolder; + import org.jetbrains.annotations.NotNull; -import vazkii.botania.common.crafting.PetalApothecaryRecipe; +import vazkii.botania.api.recipe.PetalApothecaryRecipe; public class PetalApothecaryREIDisplay extends BotaniaRecipeDisplay { - private EntryIngredient reagent; + private final EntryIngredient reagent; - public PetalApothecaryREIDisplay(PetalApothecaryRecipe recipe) { + public PetalApothecaryREIDisplay(RecipeHolder recipe) { super(recipe); - reagent = EntryIngredients.ofIngredient(recipe.getReagent()); + reagent = EntryIngredients.ofIngredient(recipe.value().getReagent()); } public EntryIngredient getReagent() { diff --git a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/PureDaisyREIDisplay.java b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/PureDaisyREIDisplay.java index 897b5e09dd..780f42f643 100644 --- a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/PureDaisyREIDisplay.java +++ b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/PureDaisyREIDisplay.java @@ -13,23 +13,23 @@ import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.entry.EntryIngredient; import me.shedaniel.rei.api.common.entry.EntryStack; -import me.shedaniel.rei.api.common.util.EntryIngredients; import me.shedaniel.rei.api.common.util.EntryStacks; +import net.minecraft.world.item.crafting.RecipeHolder; import net.minecraft.world.level.block.state.BlockState; import org.jetbrains.annotations.NotNull; -import vazkii.botania.common.crafting.PureDaisyRecipe; +import vazkii.botania.api.recipe.PureDaisyRecipe; import java.util.Collections; public class PureDaisyREIDisplay extends BotaniaRecipeDisplay { - public PureDaisyREIDisplay(PureDaisyRecipe recipe) { + public PureDaisyREIDisplay(RecipeHolder recipe) { super(recipe); ImmutableList.Builder> inputs = ImmutableList.builder(); - for (BlockState state : recipe.getInput().getDisplayed()) { + for (BlockState state : recipe.value().getInput().getDisplayed()) { if (!state.getFluidState().isEmpty()) { inputs.add(EntryStacks.of(state.getFluidState().getType())); } else { @@ -37,7 +37,16 @@ public PureDaisyREIDisplay(PureDaisyRecipe recipe) { } } this.inputs = Collections.singletonList(EntryIngredient.of(inputs.build())); - this.outputs = EntryIngredients.of(recipe.getOutputState().getBlock()); + + ImmutableList.Builder> outputs = ImmutableList.builder(); + for (BlockState state : recipe.value().getOutput().getDisplayed()) { + if (!state.getFluidState().isEmpty()) { + outputs.add(EntryStacks.of(state.getFluidState().getType())); + } else { + outputs.add(EntryStacks.of(state.getBlock())); + } + } + this.outputs = EntryIngredient.of(outputs.build()); } /*todo implement time-based hints? diff --git a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/RunicAltarREICategory.java b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/RunicAltarREICategory.java index 57a3e2662c..f95b5e9f03 100644 --- a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/RunicAltarREICategory.java +++ b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/RunicAltarREICategory.java @@ -56,7 +56,9 @@ public class RunicAltarREICategory implements DisplayCategory setupDisplay(RunicAltarREIDisplay display, Rectangle bounds) { - List inputs = display.getInputEntries(); + // TODO: optimize catalyst handling + List inputs = new ArrayList<>(display.getInputEntries()); + inputs.addAll(display.getCatalysts()); EntryStack output = display.getOutputEntries().get(0).get(0); double angleBetweenEach = 360.0 / inputs.size(); diff --git a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/RunicAltarREIDisplay.java b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/RunicAltarREIDisplay.java index 83023f28d3..741931e9ed 100644 --- a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/RunicAltarREIDisplay.java +++ b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/RunicAltarREIDisplay.java @@ -9,19 +9,32 @@ package vazkii.botania.fabric.integration.rei; import me.shedaniel.rei.api.common.category.CategoryIdentifier; +import me.shedaniel.rei.api.common.entry.EntryIngredient; +import me.shedaniel.rei.api.common.util.EntryIngredients; + +import net.minecraft.world.item.crafting.RecipeHolder; import org.jetbrains.annotations.NotNull; -import vazkii.botania.common.crafting.RunicAltarRecipe; +import vazkii.botania.api.recipe.RunicAltarRecipe; + +import java.util.List; public class RunicAltarREIDisplay extends BotaniaRecipeDisplay { - public RunicAltarREIDisplay(RunicAltarRecipe recipe) { + protected final List catalysts; + + public RunicAltarREIDisplay(RecipeHolder recipe) { super(recipe); + this.catalysts = EntryIngredients.ofIngredients(recipe.value().getCatalysts()); + } + + public List getCatalysts() { + return catalysts; } @Override public int getManaCost() { - return this.recipe.getMana(); + return this.recipe.value().getMana(); } @Override diff --git a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/TerrestrialAgglomerationREIDisplay.java b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/TerrestrialAgglomerationREIDisplay.java index 551f6c778f..0ea4346715 100644 --- a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/TerrestrialAgglomerationREIDisplay.java +++ b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/TerrestrialAgglomerationREIDisplay.java @@ -10,16 +10,18 @@ import me.shedaniel.rei.api.common.category.CategoryIdentifier; +import net.minecraft.world.item.crafting.RecipeHolder; + import vazkii.botania.api.recipe.TerrestrialAgglomerationRecipe; public class TerrestrialAgglomerationREIDisplay extends BotaniaRecipeDisplay { - public TerrestrialAgglomerationREIDisplay(TerrestrialAgglomerationRecipe recipe) { + public TerrestrialAgglomerationREIDisplay(RecipeHolder recipe) { super(recipe); } @Override public int getManaCost() { - return recipe.getMana(); + return recipe.value().getMana(); } @Override diff --git a/gradle.properties b/gradle.properties index 6aaac7508a..7c80358207 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,7 +16,7 @@ mixinextras_version=0.4.0 patchouli_version=85 jei_version=17.3.1.3 emi_version=1.1.10 -rei_version=12.0.625 +rei_version=14.1.742 trinkets_version=3.8.1 curios_version=7.4.3 ears_version=1.4.6