From 51026eb6eb3b97f0a0349bfa92e59eb66959deff Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 18 Jun 2023 18:00:59 +0200 Subject: [PATCH] [Change] Added back EMI support --- build.gradle | 7 +- gradle.properties | 4 +- .../integration/emi/EMIInfusionRecipe.java | 7 +- .../betterend/integration/emi/EMIPlugin.java | 2 +- .../emi/TransparentSlotWidget.java | 91 ------------------- src/main/resources/fabric.mod.json | 6 +- 6 files changed, 15 insertions(+), 102 deletions(-) delete mode 100644 src/main/java/org/betterx/betterend/integration/emi/TransparentSlotWidget.java diff --git a/build.gradle b/build.gradle index a85f4311..229fb98c 100644 --- a/build.gradle +++ b/build.gradle @@ -85,7 +85,7 @@ dependencies { modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - //1.19.3 modApi "vazkii.patchouli:Patchouli:${project.patchouli_version}" + modApi "vazkii.patchouli:Patchouli:${project.patchouli_version}" println "Using local BCLib: ${local_bclib}" if (local_bclib) { implementation(project(path: ":BCLib", configuration: 'dev')) @@ -98,8 +98,9 @@ dependencies { //needed for trinkets, otherwise BetterEnd would require users to install trinkets modApi "dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cca_version}" modCompileOnly "dev.emi:trinkets:${project.trinkets_version}" - modCompileOnly "dev.emi:emi:${emi_version}" - //modRuntimeOnly "dev.emi:emi:${emi_version}" + + modCompileOnly "dev.emi:emi-fabric:${emi_version}:api" + modLocalRuntime "dev.emi:emi-fabric:${emi_version}" if (local_wunderlib) { println "Using local WunderLib" diff --git a/gradle.properties b/gradle.properties index 180f5e3e..e283c3e3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,9 +18,9 @@ maven_group=org.betterx.betterend archives_base_name=better-end # Dependencies # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api -patchouli_version=1.19-73-FABRIC +patchouli_version=1.19.4-79-FABRIC bclib_version=2.3.3 rei_version=11.0.597 -emi_version=0.7.3+1.19.4 +emi_version=1.0.3+1.19.4 trinkets_version=3.6.0 cca_version=5.1.0 diff --git a/src/main/java/org/betterx/betterend/integration/emi/EMIInfusionRecipe.java b/src/main/java/org/betterx/betterend/integration/emi/EMIInfusionRecipe.java index d9e692f8..3b0750cf 100644 --- a/src/main/java/org/betterx/betterend/integration/emi/EMIInfusionRecipe.java +++ b/src/main/java/org/betterx/betterend/integration/emi/EMIInfusionRecipe.java @@ -17,6 +17,7 @@ import dev.emi.emi.api.recipe.EmiRecipeCategory; import dev.emi.emi.api.render.EmiTexture; import dev.emi.emi.api.stack.EmiIngredient; import dev.emi.emi.api.stack.EmiStack; +import dev.emi.emi.api.widget.SlotWidget; import dev.emi.emi.api.widget.WidgetHolder; import java.util.List; @@ -104,13 +105,13 @@ public class EMIInfusionRecipe implements EmiRecipe { widgets.addTexture(EmiTexture.EMPTY_ARROW, right + 10, cy - 8); // Adds an input slot on the left - widgets.add(new TransparentSlotWidget(input.get(0), cx - halfSize, cy - halfSize)); + widgets.add(new SlotWidget(input.get(0), cx - halfSize, cy - halfSize)); FormattedCharSequence str = FormattedCharSequence.forward("N", Style.EMPTY); widgets.addText(str, cx - Minecraft.getInstance().font.width(str) / 2, 4, ColorUtil.WHITE, true); double a = Math.PI; for (int i = 1; i < input.size(); i++) { - widgets.add(new TransparentSlotWidget( + widgets.add(new SlotWidget( input.get(i), cx - halfSize + (int) (Math.sin(a) * radius), cy - halfSize + (int) (Math.cos(a) * radius) @@ -121,7 +122,7 @@ public class EMIInfusionRecipe implements EmiRecipe { // Adds an output slot on the right // Note that output slots need to call `recipeContext` to inform EMI about their recipe context // This includes being able to resolve recipe trees, favorite stacks with recipe context, and more - widgets.addSlot(output.get(0), right + 40, cy - (halfSize + 4)).output(true).recipeContext(this); + widgets.addSlot(output.get(0), right + 40, cy - (halfSize + 4)).large(true).recipeContext(this); } @Override diff --git a/src/main/java/org/betterx/betterend/integration/emi/EMIPlugin.java b/src/main/java/org/betterx/betterend/integration/emi/EMIPlugin.java index e995ddd6..c06184f3 100644 --- a/src/main/java/org/betterx/betterend/integration/emi/EMIPlugin.java +++ b/src/main/java/org/betterx/betterend/integration/emi/EMIPlugin.java @@ -32,7 +32,7 @@ public class EMIPlugin implements dev.emi.emi.api.EmiPlugin { if (org.betterx.bclib.integration.emi.EMIPlugin.END_ALLOYING_CATEGORY != null) { EMIBlastingRecipe.addAllRecipes(emiRegistry, manager); } - + emiRegistry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, AZURE_JADESTONE_FURNACE_WORKSTATION); emiRegistry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, SANDY_JADESTONE_FURNACE_WORKSTATION); emiRegistry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, VIRID_JADESTONE_FURNACE_WORKSTATION); diff --git a/src/main/java/org/betterx/betterend/integration/emi/TransparentSlotWidget.java b/src/main/java/org/betterx/betterend/integration/emi/TransparentSlotWidget.java deleted file mode 100644 index 4edd600d..00000000 --- a/src/main/java/org/betterx/betterend/integration/emi/TransparentSlotWidget.java +++ /dev/null @@ -1,91 +0,0 @@ -package org.betterx.betterend.integration.emi; - -import de.ambertation.wunderlib.ui.layout.components.render.RenderHelper; - -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.client.gui.GuiComponent; - -import dev.emi.emi.EmiPort; -import dev.emi.emi.EmiRenderHelper; -import dev.emi.emi.api.render.EmiRender; -import dev.emi.emi.api.stack.EmiIngredient; -import dev.emi.emi.api.widget.Bounds; -import dev.emi.emi.api.widget.SlotWidget; -import dev.emi.emi.config.EmiConfig; - -public class TransparentSlotWidget extends SlotWidget { - - public TransparentSlotWidget(EmiIngredient stack, int x, int y) { - super(stack, x, y); - } - - - @Override - public void render(PoseStack matrices, int mouseX, int mouseY, float delta) { - Bounds bounds = this.getBounds(); - EmiPort.setPositionTexShader(); - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - int width = bounds.width(); - int height = bounds.height(); - if (this.drawBack) { - if (this.textureId != null) { - RenderSystem.setShaderTexture(0, this.textureId); - GuiComponent.blit( - matrices, - bounds.x(), bounds.y(), width, height, - this.u, this.v, width, height, 256, 256 - ); - } else { - renderSlot(matrices); - } - } - -// if (this.getRecipe() == null -// && EmiClient.availableForCrafting.containsKey(this.getStack()) -// && !this.getStack().isEmpty() -// && !(Boolean) EmiClient.availableForCrafting.get(this.getStack())) { -// GuiComponent.fill( -// matrices, -// bounds.x(), bounds.y(), -// bounds.x() + bounds.width(), bounds.y() + bounds.height(), -// 0x44FF0000 -// ); -// } - - int xOff = (width - 16) / 2; - int yOff = (height - 16) / 2; - this.getStack().render(matrices, bounds.x() + xOff, bounds.y() + yOff, delta); - if (this.catalyst) { - EmiRender.renderCatalystIcon(this.getStack(), matrices, this.x + xOff, this.y + yOff); - } - - if (EmiConfig.showHoverOverlay && bounds.contains(mouseX, mouseY)) { - EmiRenderHelper.drawSlotHightlight( - matrices, - bounds.x() + 1, bounds.y() + 1, - bounds.width() - 2, bounds.height() - 2 - ); - } - - } - - public void renderSlot(PoseStack matrices) { - Bounds bounds = this.getBounds(); - int width = bounds.width(); - int height = bounds.height(); - - GuiComponent.fill(matrices, bounds.x(), bounds.y(), bounds.x() + width, bounds.y() + height, 0xB08b8b8b); - RenderHelper.outline( - matrices, - bounds.x(), - bounds.y(), - bounds.x() + width, - bounds.y() + height, - 0xFA373737, - 0xFAFFFFFF - ); - RenderHelper.vLine(matrices, bounds.x() + width - 1, bounds.y(), bounds.y(), 0xFA8B8B8B); - RenderHelper.hLine(matrices, bounds.x(), bounds.x(), bounds.y() + bounds.height() - 1, 0xFA8B8B8B); - } -} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 125784e0..a6fd94fd 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -52,14 +52,16 @@ "bclib": "2.3.x" }, "breaks": { - "bclib": "<2.3.3" + "bclib": "<2.3.3", + "emi": "<1.0.0" }, "suggests": { "byg": ">=2.0.0", "blockus": ">=2.0.2", "nourish": ">=1.2.0", "colored_lights": ">=1.0.3", - "trinkets": ">=3.4.0" + "trinkets": ">=3.4.0", + "emi": ">=1.0.0" }, "custom": { "bclib": {