From cccc04da989f3315583816551d6c54fdce89ba0d Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Sun, 3 Sep 2023 00:12:34 -0400 Subject: [PATCH 1/2] Add EMI integration --- build.gradle | 4 ++ gradle.properties | 6 ++- .../compatibility/emi/SkyblockEmiRecipe.java | 40 +++++++++++++++++++ .../emi/SkyblockerEMIPlugin.java | 29 ++++++++++++++ .../modmenu/ModMenuEntry.java | 3 +- .../rei/SkyblockCategory.java | 21 ++-------- .../rei/SkyblockCraftingDisplay.java | 5 ++- .../rei/SkyblockCraftingDisplayGenerator.java | 10 ++--- .../rei/SkyblockerREIClientPlugin.java | 10 +---- .../mixin/accessor/HandledScreenAccessor.java | 7 +++- .../skyblock/itemlist/ItemRegistry.java | 9 ++++- .../xmrvizzy/skyblocker/utils/ItemUtils.java | 10 +++++ .../render/gui/ContainerSolverManager.java | 5 ++- .../assets/skyblocker/lang/en_us.json | 4 +- src/main/resources/fabric.mod.json | 7 +++- 15 files changed, 124 insertions(+), 46 deletions(-) create mode 100644 src/main/java/me/xmrvizzy/skyblocker/compatibility/emi/SkyblockEmiRecipe.java create mode 100644 src/main/java/me/xmrvizzy/skyblocker/compatibility/emi/SkyblockerEMIPlugin.java rename src/main/java/me/xmrvizzy/skyblocker/{config => compatibility}/modmenu/ModMenuEntry.java (90%) rename src/main/java/me/xmrvizzy/skyblocker/{skyblock => compatibility}/rei/SkyblockCategory.java (77%) rename src/main/java/me/xmrvizzy/skyblocker/{skyblock => compatibility}/rei/SkyblockCraftingDisplay.java (95%) rename src/main/java/me/xmrvizzy/skyblocker/{skyblock => compatibility}/rei/SkyblockCraftingDisplayGenerator.java (90%) rename src/main/java/me/xmrvizzy/skyblocker/{skyblock => compatibility}/rei/SkyblockerREIClientPlugin.java (77%) diff --git a/build.gradle b/build.gradle index 9157b39a8a..9697588dd9 100644 --- a/build.gradle +++ b/build.gradle @@ -56,6 +56,10 @@ dependencies { modCompileOnly "me.shedaniel:RoughlyEnoughItems-api-fabric:${project.rei_version}" modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}" + // EMI + modCompileOnly "dev.emi:emi-fabric:${project.emi_version}+${project.minecraft_version}:api" + modLocalRuntime "dev.emi:emi-fabric:${project.emi_version}+${project.minecraft_version}" + // Renderer (https://github.com/0x3C50/Renderer) include modImplementation("com.github.0x3C50:Renderer:${project.renderer_version}") { exclude group: "io.github.ladysnake" exclude module: "satin" diff --git a/gradle.properties b/gradle.properties index 2b3f61509e..e85642add0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,12 +12,14 @@ loader_version=0.14.21 fabric_api_version=0.86.0+1.20.1 # Dependencies -## Cloth Api (https://www.curseforge.com/minecraft/mc-mods/cloth-config/files) +## Cloth Api (https://modrinth.com/mod/cloth-config/versions) clothconfig_version=11.1.106 -## Mod Menu (https://www.curseforge.com/minecraft/mc-mods/modmenu/files) +## Mod Menu (https://modrinth.com/mod/modmenu/versions) mod_menu_version=7.0.1 ## REI (https://www.curseforge.com/minecraft/mc-mods/roughly-enough-items/files) rei_version=12.0.625 +## EMI (https://modrinth.com/mod/emi/versions) +emi_version = 1.0.19 ## Renderer (https://github.com/0x3C50/Renderer) renderer_version = master-SNAPSHOT diff --git a/src/main/java/me/xmrvizzy/skyblocker/compatibility/emi/SkyblockEmiRecipe.java b/src/main/java/me/xmrvizzy/skyblocker/compatibility/emi/SkyblockEmiRecipe.java new file mode 100644 index 0000000000..26131b7af1 --- /dev/null +++ b/src/main/java/me/xmrvizzy/skyblocker/compatibility/emi/SkyblockEmiRecipe.java @@ -0,0 +1,40 @@ +package me.xmrvizzy.skyblocker.compatibility.emi; + +import dev.emi.emi.api.recipe.EmiCraftingRecipe; +import dev.emi.emi.api.recipe.EmiRecipeCategory; +import dev.emi.emi.api.stack.EmiIngredient; +import dev.emi.emi.api.stack.EmiStack; +import dev.emi.emi.api.widget.WidgetHolder; +import me.xmrvizzy.skyblocker.skyblock.itemlist.ItemRegistry; +import me.xmrvizzy.skyblocker.skyblock.itemlist.SkyblockCraftingRecipe; +import net.minecraft.client.MinecraftClient; +import net.minecraft.text.Text; +import net.minecraft.util.Identifier; + +public class SkyblockEmiRecipe extends EmiCraftingRecipe { + private final String craftText; + + public SkyblockEmiRecipe(SkyblockCraftingRecipe recipe) { + super(recipe.getGrid().stream().map(EmiStack::of).map(EmiIngredient.class::cast).toList(), EmiStack.of(recipe.getResult()), Identifier.of("skyblock", ItemRegistry.getInternalName(recipe.getResult()).toLowerCase().replace(';', '_'))); + if (Identifier.of("skyblock", ItemRegistry.getInternalName(recipe.getResult()).toLowerCase().replace(';', '_')) == null) { + System.out.println("[Skyblocker EMI] Failed to register recipe for " + recipe.getResult().getName().getString() + " [Internal name: " + ItemRegistry.getInternalName(recipe.getResult()) + "]"); + } + this.craftText = recipe.getCraftText(); + } + + @Override + public EmiRecipeCategory getCategory() { + return SkyblockerEMIPlugin.SKYBLOCK; + } + + @Override + public int getDisplayHeight() { + return super.getDisplayHeight() + (craftText.isEmpty() ? 0 : 10); + } + + @Override + public void addWidgets(WidgetHolder widgets) { + super.addWidgets(widgets); + widgets.addText(Text.of(craftText), 59 - MinecraftClient.getInstance().textRenderer.getWidth(craftText) / 2, 55, 0xFFFFFF, true); + } +} diff --git a/src/main/java/me/xmrvizzy/skyblocker/compatibility/emi/SkyblockerEMIPlugin.java b/src/main/java/me/xmrvizzy/skyblocker/compatibility/emi/SkyblockerEMIPlugin.java new file mode 100644 index 0000000000..526ac88532 --- /dev/null +++ b/src/main/java/me/xmrvizzy/skyblocker/compatibility/emi/SkyblockerEMIPlugin.java @@ -0,0 +1,29 @@ +package me.xmrvizzy.skyblocker.compatibility.emi; + +import dev.emi.emi.api.EmiPlugin; +import dev.emi.emi.api.EmiRegistry; +import dev.emi.emi.api.recipe.EmiRecipeCategory; +import dev.emi.emi.api.render.EmiTexture; +import dev.emi.emi.api.stack.EmiStack; +import me.xmrvizzy.skyblocker.SkyblockerMod; +import me.xmrvizzy.skyblocker.skyblock.itemlist.ItemRegistry; +import me.xmrvizzy.skyblocker.utils.ItemUtils; +import net.minecraft.item.Items; +import net.minecraft.util.Identifier; + +/** + * EMI integration + */ +public class SkyblockerEMIPlugin implements EmiPlugin { + public static final Identifier SIMPLIFIED_TEXTURES = new Identifier("emi", "textures/gui/widgets.png"); + // TODO: Custom simplified texture for Skyblock + public static final EmiRecipeCategory SKYBLOCK = new EmiRecipeCategory(new Identifier(SkyblockerMod.NAMESPACE, "skyblock"), EmiStack.of(ItemUtils.getSkyblockerStack()), new EmiTexture(SIMPLIFIED_TEXTURES, 240, 240, 16, 16)); + + @Override + public void register(EmiRegistry registry) { + ItemRegistry.getRecipeResultsStream().map(EmiStack::of).forEach(registry::addEmiStack); + registry.addCategory(SKYBLOCK); + registry.addWorkstation(SKYBLOCK, EmiStack.of(Items.CRAFTING_TABLE)); + ItemRegistry.getRecipesStream().map(SkyblockEmiRecipe::new).forEach(registry::addRecipe); + } +} diff --git a/src/main/java/me/xmrvizzy/skyblocker/config/modmenu/ModMenuEntry.java b/src/main/java/me/xmrvizzy/skyblocker/compatibility/modmenu/ModMenuEntry.java similarity index 90% rename from src/main/java/me/xmrvizzy/skyblocker/config/modmenu/ModMenuEntry.java rename to src/main/java/me/xmrvizzy/skyblocker/compatibility/modmenu/ModMenuEntry.java index f9d4e8fe54..0cba3d5ed0 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/config/modmenu/ModMenuEntry.java +++ b/src/main/java/me/xmrvizzy/skyblocker/compatibility/modmenu/ModMenuEntry.java @@ -1,4 +1,4 @@ -package me.xmrvizzy.skyblocker.config.modmenu; +package me.xmrvizzy.skyblocker.compatibility.modmenu; import me.shedaniel.autoconfig.AutoConfig; import com.terraformersmc.modmenu.api.ConfigScreenFactory; @@ -9,7 +9,6 @@ @Environment(EnvType.CLIENT) public class ModMenuEntry implements ModMenuApi { - @Override public ConfigScreenFactory getModConfigScreenFactory() { return screen -> AutoConfig.getConfigScreen(SkyblockerConfig.class, screen).get(); diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/rei/SkyblockCategory.java b/src/main/java/me/xmrvizzy/skyblocker/compatibility/rei/SkyblockCategory.java similarity index 77% rename from src/main/java/me/xmrvizzy/skyblocker/skyblock/rei/SkyblockCategory.java rename to src/main/java/me/xmrvizzy/skyblocker/compatibility/rei/SkyblockCategory.java index 3b402dc9df..14c61d238c 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/rei/SkyblockCategory.java +++ b/src/main/java/me/xmrvizzy/skyblocker/compatibility/rei/SkyblockCategory.java @@ -1,7 +1,6 @@ -package me.xmrvizzy.skyblocker.skyblock.rei; +package me.xmrvizzy.skyblocker.compatibility.rei; import com.google.common.collect.Lists; -import com.mojang.brigadier.exceptions.CommandSyntaxException; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.gui.Renderer; @@ -13,14 +12,11 @@ import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.entry.EntryIngredient; import me.shedaniel.rei.api.common.util.EntryStacks; -import me.xmrvizzy.skyblocker.config.SkyblockerConfig; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.StringNbtReader; +import me.xmrvizzy.skyblocker.utils.ItemUtils; import net.minecraft.text.Text; import java.util.ArrayList; import java.util.List; -import java.util.Locale; /** * Skyblock recipe category class for REI @@ -33,21 +29,12 @@ public CategoryIdentifier getCategoryIdentifier() { @Override public Text getTitle() { - return Text.translatable("key.categories.skyblocker"); + return Text.translatable("emi.category.skyblocker.skyblock"); } @Override public Renderer getIcon() { - // TODO separate icon from quickNav - SkyblockerConfig.ItemData iconItem = SkyblockerConfig.get().quickNav.button7.item; - String nbtString = "{id:\"minecraft:" + iconItem.itemName.toLowerCase(Locale.ROOT) + "\",Count:1"; - if (iconItem.nbt.length() > 2) nbtString += "," + iconItem.nbt; - nbtString += "}"; - try { - return EntryStacks.of(ItemStack.fromNbt(StringNbtReader.parse(nbtString))); - } catch (CommandSyntaxException e) { - throw new RuntimeException(e); - } + return EntryStacks.of(ItemUtils.getSkyblockerStack()); } @Override diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/rei/SkyblockCraftingDisplay.java b/src/main/java/me/xmrvizzy/skyblocker/compatibility/rei/SkyblockCraftingDisplay.java similarity index 95% rename from src/main/java/me/xmrvizzy/skyblocker/skyblock/rei/SkyblockCraftingDisplay.java rename to src/main/java/me/xmrvizzy/skyblocker/compatibility/rei/SkyblockCraftingDisplay.java index 5820780ca4..35b5c8860f 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/rei/SkyblockCraftingDisplay.java +++ b/src/main/java/me/xmrvizzy/skyblocker/compatibility/rei/SkyblockCraftingDisplay.java @@ -1,4 +1,4 @@ -package me.xmrvizzy.skyblocker.skyblock.rei; +package me.xmrvizzy.skyblocker.compatibility.rei; import me.shedaniel.rei.api.common.category.CategoryIdentifier; @@ -12,12 +12,13 @@ * Skyblock Crafting Recipe display class for REI */ public class SkyblockCraftingDisplay extends BasicDisplay implements SimpleGridMenuDisplay { - private final String craftText; + public SkyblockCraftingDisplay(List input, List output, String craftText) { super(input, output); this.craftText = craftText; } + public String getCraftText() { return craftText; } diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/rei/SkyblockCraftingDisplayGenerator.java b/src/main/java/me/xmrvizzy/skyblocker/compatibility/rei/SkyblockCraftingDisplayGenerator.java similarity index 90% rename from src/main/java/me/xmrvizzy/skyblocker/skyblock/rei/SkyblockCraftingDisplayGenerator.java rename to src/main/java/me/xmrvizzy/skyblocker/compatibility/rei/SkyblockCraftingDisplayGenerator.java index fd3f56eeb4..370e15dc35 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/rei/SkyblockCraftingDisplayGenerator.java +++ b/src/main/java/me/xmrvizzy/skyblocker/compatibility/rei/SkyblockCraftingDisplayGenerator.java @@ -1,4 +1,4 @@ -package me.xmrvizzy.skyblocker.skyblock.rei; +package me.xmrvizzy.skyblocker.compatibility.rei; import me.shedaniel.rei.api.client.registry.display.DynamicDisplayGenerator; import me.shedaniel.rei.api.common.entry.EntryIngredient; @@ -18,8 +18,7 @@ public class SkyblockCraftingDisplayGenerator implements DynamicDisplayGenerator public Optional> getRecipeFor(EntryStack entry) { if (!(entry.getValue() instanceof ItemStack)) return Optional.empty(); EntryStack inputItem = EntryStacks.of((ItemStack) entry.getValue()); - List filteredRecipes = ItemRegistry.getRecipes() - .stream() + List filteredRecipes = ItemRegistry.getRecipesStream() .filter(recipe -> ItemRegistry.getInternalName(recipe.getResult()).equals(ItemRegistry.getInternalName(inputItem.getValue()))) .toList(); @@ -30,11 +29,10 @@ public Optional> getRecipeFor(EntryStack entry) public Optional> getUsageFor(EntryStack entry) { if (!(entry.getValue() instanceof ItemStack)) return Optional.empty(); EntryStack inputItem = EntryStacks.of((ItemStack) entry.getValue()); - List filteredRecipes = ItemRegistry.getRecipes() - .stream() + List filteredRecipes = ItemRegistry.getRecipesStream() .filter(recipe -> { for (ItemStack item : recipe.getGrid()) { - if(!ItemRegistry.getInternalName(item).equals("") && ItemRegistry.getInternalName(item).equals(ItemRegistry.getInternalName(inputItem.getValue()))) + if(!ItemRegistry.getInternalName(item).isEmpty() && ItemRegistry.getInternalName(item).equals(ItemRegistry.getInternalName(inputItem.getValue()))) return true; } return false; diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/rei/SkyblockerREIClientPlugin.java b/src/main/java/me/xmrvizzy/skyblocker/compatibility/rei/SkyblockerREIClientPlugin.java similarity index 77% rename from src/main/java/me/xmrvizzy/skyblocker/skyblock/rei/SkyblockerREIClientPlugin.java rename to src/main/java/me/xmrvizzy/skyblocker/compatibility/rei/SkyblockerREIClientPlugin.java index 5f43ca0e1a..5c97a27467 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/rei/SkyblockerREIClientPlugin.java +++ b/src/main/java/me/xmrvizzy/skyblocker/compatibility/rei/SkyblockerREIClientPlugin.java @@ -1,19 +1,15 @@ -package me.xmrvizzy.skyblocker.skyblock.rei; +package me.xmrvizzy.skyblocker.compatibility.rei; import me.shedaniel.rei.api.client.plugins.REIClientPlugin; import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; import me.shedaniel.rei.api.client.registry.entry.EntryRegistry; import me.shedaniel.rei.api.common.category.CategoryIdentifier; -import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.util.EntryStacks; import me.xmrvizzy.skyblocker.SkyblockerMod; import me.xmrvizzy.skyblocker.skyblock.itemlist.ItemRegistry; -import net.minecraft.item.ItemStack; import net.minecraft.item.Items; -import java.util.ArrayList; - /** * REI integration */ @@ -33,8 +29,6 @@ public void registerDisplays(DisplayRegistry displayRegistry) { @Override public void registerEntries(EntryRegistry entryRegistry) { - ArrayList> entries = new ArrayList<>(); - ItemRegistry.getRecipes().forEach(recipe -> entries.add(EntryStacks.of(recipe.getResult()))); - entryRegistry.addEntries(entries); + entryRegistry.addEntries(ItemRegistry.getRecipeResultsStream().map(EntryStacks::of).toList()); } } diff --git a/src/main/java/me/xmrvizzy/skyblocker/mixin/accessor/HandledScreenAccessor.java b/src/main/java/me/xmrvizzy/skyblocker/mixin/accessor/HandledScreenAccessor.java index ad35dae67c..e6e0ebb715 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/mixin/accessor/HandledScreenAccessor.java +++ b/src/main/java/me/xmrvizzy/skyblocker/mixin/accessor/HandledScreenAccessor.java @@ -6,12 +6,15 @@ @Mixin(HandledScreen.class) public interface HandledScreenAccessor { - @Accessor + @Accessor("x") int getX(); - @Accessor + + @Accessor("y") int getY(); + @Accessor int getBackgroundWidth(); + @Accessor int getBackgroundHeight(); } diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/itemlist/ItemRegistry.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/itemlist/ItemRegistry.java index dc63e351c2..a4b566e8be 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/itemlist/ItemRegistry.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/itemlist/ItemRegistry.java @@ -16,6 +16,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Stream; public class ItemRegistry { protected static final Path ITEM_LIST_DIR = NEURepo.LOCAL_REPO_DIR.resolve("items"); @@ -105,8 +106,12 @@ public static List getRecipes(String internalName) { return result; } - public static List getRecipes() { - return recipes; + public static Stream getRecipesStream() { + return recipes.stream(); + } + + public static Stream getRecipeResultsStream() { + return recipes.stream().map(SkyblockCraftingRecipe::getResult); } /** diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/ItemUtils.java b/src/main/java/me/xmrvizzy/skyblocker/utils/ItemUtils.java index 4f74ce3abc..5c12b7776b 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/ItemUtils.java +++ b/src/main/java/me/xmrvizzy/skyblocker/utils/ItemUtils.java @@ -1,8 +1,10 @@ package me.xmrvizzy.skyblocker.utils; +import com.mojang.brigadier.exceptions.CommandSyntaxException; import net.minecraft.client.MinecraftClient; import net.minecraft.client.item.TooltipContext; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.StringNbtReader; import net.minecraft.text.Text; import java.util.ArrayList; @@ -30,4 +32,12 @@ public static List getTooltipStrings(ItemStack item) { return list; } + + public static ItemStack getSkyblockerStack() { + try { + return ItemStack.fromNbt(StringNbtReader.parse("{id:\"minecraft:player_head\",Count:1,tag:{SkullOwner:{Id:[I;-300151517,-631415889,-1193921967,-1821784279],Properties:{textures:[{Value:\"e3RleHR1cmVzOntTS0lOOnt1cmw6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDdjYzY2ODc0MjNkMDU3MGQ1NTZhYzUzZTA2NzZjYjU2M2JiZGQ5NzE3Y2Q4MjY5YmRlYmVkNmY2ZDRlN2JmOCJ9fX0=\"}]}}}}")); + } catch (CommandSyntaxException e) { + throw new RuntimeException(e); + } + } } diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/render/gui/ContainerSolverManager.java b/src/main/java/me/xmrvizzy/skyblocker/utils/render/gui/ContainerSolverManager.java index be1d01b41a..f78222d0f2 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/render/gui/ContainerSolverManager.java +++ b/src/main/java/me/xmrvizzy/skyblocker/utils/render/gui/ContainerSolverManager.java @@ -54,7 +54,7 @@ public void init() { ScreenEvents.BEFORE_INIT.register((client, screen, scaledWidth, scaledHeight) -> { if (Utils.isOnSkyblock() && screen instanceof GenericContainerScreen genericContainerScreen) { ScreenEvents.afterRender(screen).register((screen1, context, mouseX, mouseY, delta) -> { - MatrixStack matrices = context.getMatrices(); + MatrixStack matrices = context.getMatrices(); matrices.push(); matrices.translate(((HandledScreenAccessor) genericContainerScreen).getX(), ((HandledScreenAccessor) genericContainerScreen).getY(), 300); onDraw(context, genericContainerScreen.getScreenHandler().slots.subList(0, genericContainerScreen.getScreenHandler().getRows() * 9)); @@ -117,8 +117,9 @@ public void onDraw(DrawContext context, List slots) { private Map slotMap(List slots) { Map slotMap = new TreeMap<>(); - for (int i = 0; i < slots.size(); i++) + for (int i = 0; i < slots.size(); i++) { slotMap.put(i, slots.get(i).getStack()); + } return slotMap; } } diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 33f6ff9c56..b2c7fe9e17 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -349,5 +349,7 @@ "skyblocker.quiverWarning.50Left": "You only have 50 Arrows left in your Quiver!", "skyblocker.quiverWarning.10Left": "You only have 10 Arrows left in your Quiver!", - "skyblocker.quiverWarning.empty": "You don't have any more Arrows left in your Quiver!" + "skyblocker.quiverWarning.empty": "You don't have any more Arrows left in your Quiver!", + + "emi.category.skyblocker.skyblock": "Skyblock" } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 596fe8cfae..cf7e639c77 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -22,10 +22,13 @@ "dev.cbyrne.betterinject.BetterInject::initialize" ], "modmenu": [ - "me.xmrvizzy.skyblocker.config.modmenu.ModMenuEntry" + "me.xmrvizzy.skyblocker.compatibility.modmenu.ModMenuEntry" ], "rei_client": [ - "me.xmrvizzy.skyblocker.skyblock.rei.SkyblockerREIClientPlugin" + "me.xmrvizzy.skyblocker.compatibility.rei.SkyblockerREIClientPlugin" + ], + "emi": [ + "me.xmrvizzy.skyblocker.compatibility.emi.SkyblockerEMIPlugin" ] }, "mixins": [ From 4b790182dc7ae74afdd196be58a174f10632abbf Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Tue, 5 Sep 2023 20:15:54 -0400 Subject: [PATCH 2/2] Compare nbt in emi --- .../skyblocker/compatibility/emi/SkyblockEmiRecipe.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/xmrvizzy/skyblocker/compatibility/emi/SkyblockEmiRecipe.java b/src/main/java/me/xmrvizzy/skyblocker/compatibility/emi/SkyblockEmiRecipe.java index 26131b7af1..6cf91dac35 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/compatibility/emi/SkyblockEmiRecipe.java +++ b/src/main/java/me/xmrvizzy/skyblocker/compatibility/emi/SkyblockEmiRecipe.java @@ -2,6 +2,7 @@ import dev.emi.emi.api.recipe.EmiCraftingRecipe; import dev.emi.emi.api.recipe.EmiRecipeCategory; +import dev.emi.emi.api.stack.Comparison; import dev.emi.emi.api.stack.EmiIngredient; import dev.emi.emi.api.stack.EmiStack; import dev.emi.emi.api.widget.WidgetHolder; @@ -15,10 +16,7 @@ public class SkyblockEmiRecipe extends EmiCraftingRecipe { private final String craftText; public SkyblockEmiRecipe(SkyblockCraftingRecipe recipe) { - super(recipe.getGrid().stream().map(EmiStack::of).map(EmiIngredient.class::cast).toList(), EmiStack.of(recipe.getResult()), Identifier.of("skyblock", ItemRegistry.getInternalName(recipe.getResult()).toLowerCase().replace(';', '_'))); - if (Identifier.of("skyblock", ItemRegistry.getInternalName(recipe.getResult()).toLowerCase().replace(';', '_')) == null) { - System.out.println("[Skyblocker EMI] Failed to register recipe for " + recipe.getResult().getName().getString() + " [Internal name: " + ItemRegistry.getInternalName(recipe.getResult()) + "]"); - } + super(recipe.getGrid().stream().map(EmiStack::of).map(EmiIngredient.class::cast).toList(), EmiStack.of(recipe.getResult()).comparison(Comparison.compareNbt()), Identifier.of("skyblock", ItemRegistry.getInternalName(recipe.getResult()).toLowerCase().replace(';', '_'))); this.craftText = recipe.getCraftText(); }