[Change] Added back EMI support

This commit is contained in:
Frank 2023-06-18 18:00:59 +02:00
parent 39b12ed84b
commit 51026eb6eb
6 changed files with 15 additions and 102 deletions

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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);
}
}

View file

@ -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": {