[Change] Re-Enabled EMI Support

This commit is contained in:
Frank 2023-06-13 17:05:20 +02:00
parent 4c2841502f
commit e74caf9198
6 changed files with 210 additions and 298 deletions

View file

@ -98,7 +98,9 @@ dependencies {
//needed for trinkets, otherwise BetterEnd would require users to install trinkets //needed for trinkets, otherwise BetterEnd would require users to install trinkets
// modApi "dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cca_version}" // modApi "dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cca_version}"
// modCompileOnly "dev.emi:trinkets:${project.trinkets_version}" // modCompileOnly "dev.emi:trinkets:${project.trinkets_version}"
// modCompileOnly "dev.emi:emi:${emi_version}"
modCompileOnly "dev.emi:emi-fabric:${emi_version}:api"
modLocalRuntime "dev.emi:emi-fabric:${emi_version}"
if (local_wunderlib) { if (local_wunderlib) {
println "Using local WunderLib" println "Using local WunderLib"

View file

@ -21,6 +21,6 @@ archives_base_name=better-end
patchouli_version=1.19-73-FABRIC patchouli_version=1.19-73-FABRIC
bclib_version=3.0.3 bclib_version=3.0.3
rei_version=12.0.622 rei_version=12.0.622
emi_version=0.7.3+1.19.4 emi_version=1.0.2+1.20
trinkets_version=3.6.0 trinkets_version=3.6.0
cca_version=5.1.0 cca_version=5.1.0

View file

@ -1,40 +1,40 @@
package org.betterx.betterend.integration.emi; package org.betterx.betterend.integration.emi;
//import org.betterx.bclib.integration.emi.EMIAbstractAlloyingRecipe; import org.betterx.bclib.integration.emi.EMIAbstractAlloyingRecipe;
//import org.betterx.bclib.integration.emi.EMIPlugin; import org.betterx.bclib.integration.emi.EMIPlugin;
//import org.betterx.betterend.BetterEnd; import org.betterx.betterend.BetterEnd;
//
//import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
//import net.minecraft.world.Container; import net.minecraft.world.Container;
//import net.minecraft.world.item.crafting.BlastingRecipe; import net.minecraft.world.item.crafting.BlastingRecipe;
//import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.item.crafting.RecipeManager;
//import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.item.crafting.RecipeType;
//
//import dev.emi.emi.api.EmiRegistry; import dev.emi.emi.api.EmiRegistry;
//
//public class EMIBlastingRecipe extends EMIAbstractAlloyingRecipe<Container, BlastingRecipe> { public class EMIBlastingRecipe extends EMIAbstractAlloyingRecipe<Container, BlastingRecipe> {
// public EMIBlastingRecipe(BlastingRecipe recipe) { public EMIBlastingRecipe(BlastingRecipe recipe) {
// super(recipe, new ResourceLocation( super(recipe, new ResourceLocation(
// "emi", "emi",
// recipe.getId().getNamespace() + "/" + recipe.getId().getPath() + "/allloying" recipe.getId().getNamespace() + "/" + recipe.getId().getPath() + "/allloying"
// ), 1, false); ), 1, false);
// } }
//
// @Override @Override
// protected int getSmeltTime() { protected int getSmeltTime() {
// return recipe.getCookingTime(); return recipe.getCookingTime();
// } }
//
// @Override @Override
// protected float getExperience() { protected float getExperience() {
// return recipe.getExperience(); return recipe.getExperience();
// } }
//
//
// static void addAllRecipes(EmiRegistry emiRegistry, RecipeManager manager) { static void addAllRecipes(EmiRegistry emiRegistry, RecipeManager manager) {
// EMIPlugin.addAllRecipes( EMIPlugin.addAllRecipes(
// emiRegistry, manager, BetterEnd.LOGGER, emiRegistry, manager, BetterEnd.LOGGER,
// RecipeType.BLASTING, EMIBlastingRecipe::new RecipeType.BLASTING, EMIBlastingRecipe::new
// ); );
// } }
//} }

View file

@ -1,131 +1,132 @@
package org.betterx.betterend.integration.emi; package org.betterx.betterend.integration.emi;
//import org.betterx.betterend.BetterEnd; import org.betterx.betterend.BetterEnd;
//import org.betterx.betterend.recipe.builders.InfusionRecipe; import org.betterx.betterend.recipe.builders.InfusionRecipe;
//import org.betterx.ui.ColorUtil; import org.betterx.ui.ColorUtil;
//
//import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
//import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
//import net.minecraft.network.chat.Style; import net.minecraft.network.chat.Style;
//import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
//import net.minecraft.util.FormattedCharSequence; import net.minecraft.util.FormattedCharSequence;
//import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.item.crafting.RecipeManager;
//
//import dev.emi.emi.api.EmiRegistry; import dev.emi.emi.api.EmiRegistry;
//import dev.emi.emi.api.recipe.EmiRecipe; import dev.emi.emi.api.recipe.EmiRecipe;
//import dev.emi.emi.api.recipe.EmiRecipeCategory; import dev.emi.emi.api.recipe.EmiRecipeCategory;
//import dev.emi.emi.api.render.EmiTexture; import dev.emi.emi.api.render.EmiTexture;
//import dev.emi.emi.api.stack.EmiIngredient; import dev.emi.emi.api.stack.EmiIngredient;
//import dev.emi.emi.api.stack.EmiStack; import dev.emi.emi.api.stack.EmiStack;
//import dev.emi.emi.api.widget.WidgetHolder; import dev.emi.emi.api.widget.SlotWidget;
// import dev.emi.emi.api.widget.WidgetHolder;
//import java.util.List;
//import org.jetbrains.annotations.Nullable; import java.util.List;
// import org.jetbrains.annotations.Nullable;
//public class EMIInfusionRecipe implements EmiRecipe {
// public final static EmiTexture BACKGROUND = new EmiTexture( public class EMIInfusionRecipe implements EmiRecipe {
// BetterEnd.makeID("textures/gui/infusion.png"), public final static EmiTexture BACKGROUND = new EmiTexture(
// 0, 0, BetterEnd.makeID("textures/gui/infusion.png"),
// 84, 84, 84, 84, 84, 84 0, 0,
// ); 84, 84, 84, 84, 84, 84
// );
// public final Component[] ORIENTATIONS = {
// Component.translatable("betterend.infusion.north").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)), public final Component[] ORIENTATIONS = {
// Component.translatable("betterend.infusion.north_east").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)), Component.translatable("betterend.infusion.north").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)),
// Component.translatable("betterend.infusion.east").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)), Component.translatable("betterend.infusion.north_east").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)),
// Component.translatable("betterend.infusion.south_east").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)), Component.translatable("betterend.infusion.east").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)),
// Component.translatable("betterend.infusion.south").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)), Component.translatable("betterend.infusion.south_east").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)),
// Component.translatable("betterend.infusion.south_west").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)), Component.translatable("betterend.infusion.south").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)),
// Component.translatable("betterend.infusion.west").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)), Component.translatable("betterend.infusion.south_west").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)),
// Component.translatable("betterend.infusion.north_west").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)), Component.translatable("betterend.infusion.west").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)),
// }; Component.translatable("betterend.infusion.north_west").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)),
// private final ResourceLocation id; };
// private final List<EmiIngredient> input; private final ResourceLocation id;
// private final List<EmiStack> output; private final List<EmiIngredient> input;
// private final List<EmiStack> output;
// public EMIInfusionRecipe(InfusionRecipe recipe) {
// this.id = recipe.getId(); public EMIInfusionRecipe(InfusionRecipe recipe) {
// this.input = recipe.getIngredients().stream().map(i -> EmiIngredient.of(i)).toList(); this.id = recipe.getId();
// this.output = List.of(EmiStack.of(recipe.getResultItem(Minecraft.getInstance().level.registryAccess()))); this.input = recipe.getIngredients().stream().map(i -> EmiIngredient.of(i)).toList();
// } this.output = List.of(EmiStack.of(recipe.getResultItem(Minecraft.getInstance().level.registryAccess())));
// }
// static void addAllRecipes(EmiRegistry emiRegistry, RecipeManager manager) {
// org.betterx.bclib.integration.emi.EMIPlugin.addAllRecipes( static void addAllRecipes(EmiRegistry emiRegistry, RecipeManager manager) {
// emiRegistry, manager, BetterEnd.LOGGER, org.betterx.bclib.integration.emi.EMIPlugin.addAllRecipes(
// InfusionRecipe.TYPE, EMIInfusionRecipe::new emiRegistry, manager, BetterEnd.LOGGER,
// ); InfusionRecipe.TYPE, EMIInfusionRecipe::new
// } );
// }
//
// @Override
// public EmiRecipeCategory getCategory() { @Override
// return EMIPlugin.INFUSION_CATEGORY; public EmiRecipeCategory getCategory() {
// } return EMIPlugin.INFUSION_CATEGORY;
// }
// @Override
// public @Nullable ResourceLocation getId() { @Override
// return id; public @Nullable ResourceLocation getId() {
// } return id;
// }
// @Override
// public List<EmiIngredient> getInputs() { @Override
// return input; public List<EmiIngredient> getInputs() {
// } return input;
// }
// @Override
// public List<EmiStack> getOutputs() { @Override
// return output; public List<EmiStack> getOutputs() {
// } return output;
// }
// @Override
// public int getDisplayWidth() { @Override
// return 4 + 10 + 84 + 68; public int getDisplayWidth() {
// } return 4 + 10 + 84 + 68;
// }
// @Override
// public int getDisplayHeight() { @Override
// return 4 + 20 + 84; public int getDisplayHeight() {
// } return 4 + 20 + 84;
// }
// @Override
// public void addWidgets(WidgetHolder widgets) { @Override
// final int radius = 36; public void addWidgets(WidgetHolder widgets) {
// final int halfSize = 9; final int radius = 36;
// final int left = 10; final int halfSize = 9;
// final int top = 17; final int left = 10;
// final int top = 17;
// final int cx = left + 84 / 2;
// final int cy = top + 84 / 2; final int cx = left + 84 / 2;
// final int cy = top + 84 / 2;
// final int right = left + 84;
// final int bottom = top + 84; final int right = left + 84;
// widgets.addTexture(BACKGROUND, left, top); final int bottom = top + 84;
// // Add an arrow texture to indicate processing widgets.addTexture(BACKGROUND, left, top);
// widgets.addTexture(EmiTexture.EMPTY_ARROW, right + 10, cy - 8); // Add an arrow texture to indicate processing
// 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)); // Adds an input slot on the left
// 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); FormattedCharSequence str = FormattedCharSequence.forward("N", Style.EMPTY);
// double a = Math.PI; widgets.addText(str, cx - Minecraft.getInstance().font.width(str) / 2, 4, ColorUtil.WHITE, true);
// for (int i = 1; i < input.size(); i++) { double a = Math.PI;
// widgets.add(new TransparentSlotWidget( for (int i = 1; i < input.size(); i++) {
// input.get(i), widgets.add(new SlotWidget(
// cx - halfSize + (int) (Math.sin(a) * radius), input.get(i),
// cy - halfSize + (int) (Math.cos(a) * radius) cx - halfSize + (int) (Math.sin(a) * radius),
// )).appendTooltip(ORIENTATIONS[i - 1]); cy - halfSize + (int) (Math.cos(a) * radius)
// a -= Math.PI / 4; )).appendTooltip(ORIENTATIONS[i - 1]);
// } a -= Math.PI / 4;
// }
// // Adds an output slot on the right
// // Note that output slots need to call `recipeContext` to inform EMI about their recipe context // Adds an output slot on the right
// // This includes being able to resolve recipe trees, favorite stacks with recipe context, and more // Note that output slots need to call `recipeContext` to inform EMI about their recipe context
// widgets.addSlot(output.get(0), right + 40, cy - (halfSize + 4)).output(true).recipeContext(this); // 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)).large(true).recipeContext(this);
// }
// @Override
// public boolean supportsRecipeTree() { @Override
// return true; public boolean supportsRecipeTree() {
// } return true;
//} }
}

View file

@ -1,40 +1,40 @@
package org.betterx.betterend.integration.emi; package org.betterx.betterend.integration.emi;
//import org.betterx.betterend.BetterEnd; import org.betterx.betterend.BetterEnd;
//import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
//
//import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.item.crafting.RecipeManager;
//
//import dev.emi.emi.api.EmiRegistry; import dev.emi.emi.api.EmiRegistry;
//import dev.emi.emi.api.recipe.EmiRecipeCategory; import dev.emi.emi.api.recipe.EmiRecipeCategory;
//import dev.emi.emi.api.recipe.VanillaEmiRecipeCategories; import dev.emi.emi.api.recipe.VanillaEmiRecipeCategories;
//import dev.emi.emi.api.stack.EmiStack; import dev.emi.emi.api.stack.EmiStack;
//
//public class EMIPlugin implements dev.emi.emi.api.EmiPlugin { public class EMIPlugin implements dev.emi.emi.api.EmiPlugin {
// public static final EmiStack INFUSION_WORKSTATION = EmiStack.of(EndBlocks.INFUSION_PEDESTAL); public static final EmiStack INFUSION_WORKSTATION = EmiStack.of(EndBlocks.INFUSION_PEDESTAL);
// public static final EmiStack AZURE_JADESTONE_FURNACE_WORKSTATION = EmiStack.of(EndBlocks.AZURE_JADESTONE.furnace); public static final EmiStack AZURE_JADESTONE_FURNACE_WORKSTATION = EmiStack.of(EndBlocks.AZURE_JADESTONE.furnace);
// public static final EmiStack SANDY_JADESTONE_FURNACE_WORKSTATION = EmiStack.of(EndBlocks.SANDY_JADESTONE.furnace); public static final EmiStack SANDY_JADESTONE_FURNACE_WORKSTATION = EmiStack.of(EndBlocks.SANDY_JADESTONE.furnace);
// public static final EmiStack VIRID_JADESTONE_FURNACE_WORKSTATION = EmiStack.of(EndBlocks.VIRID_JADESTONE.furnace); public static final EmiStack VIRID_JADESTONE_FURNACE_WORKSTATION = EmiStack.of(EndBlocks.VIRID_JADESTONE.furnace);
//
// public static final EmiRecipeCategory INFUSION_CATEGORY = new EmiRecipeCategory( public static final EmiRecipeCategory INFUSION_CATEGORY = new EmiRecipeCategory(
// BetterEnd.makeID("infusion"), BetterEnd.makeID("infusion"),
// INFUSION_WORKSTATION, INFUSION_WORKSTATION,
// org.betterx.bclib.integration.emi.EMIPlugin.getSprite(0, 16) org.betterx.bclib.integration.emi.EMIPlugin.getSprite(0, 16)
// ); );
//
// @Override @Override
// public void register(EmiRegistry emiRegistry) { public void register(EmiRegistry emiRegistry) {
// final RecipeManager manager = emiRegistry.getRecipeManager(); final RecipeManager manager = emiRegistry.getRecipeManager();
// emiRegistry.addCategory(INFUSION_CATEGORY); emiRegistry.addCategory(INFUSION_CATEGORY);
// emiRegistry.addWorkstation(INFUSION_CATEGORY, INFUSION_WORKSTATION); emiRegistry.addWorkstation(INFUSION_CATEGORY, INFUSION_WORKSTATION);
//
// EMIInfusionRecipe.addAllRecipes(emiRegistry, manager); EMIInfusionRecipe.addAllRecipes(emiRegistry, manager);
// if (org.betterx.bclib.integration.emi.EMIPlugin.END_ALLOYING_CATEGORY != null) { if (org.betterx.bclib.integration.emi.EMIPlugin.END_ALLOYING_CATEGORY != null) {
// EMIBlastingRecipe.addAllRecipes(emiRegistry, manager); EMIBlastingRecipe.addAllRecipes(emiRegistry, manager);
// } }
//
// emiRegistry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, AZURE_JADESTONE_FURNACE_WORKSTATION); emiRegistry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, AZURE_JADESTONE_FURNACE_WORKSTATION);
// emiRegistry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, SANDY_JADESTONE_FURNACE_WORKSTATION); emiRegistry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, SANDY_JADESTONE_FURNACE_WORKSTATION);
// emiRegistry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, VIRID_JADESTONE_FURNACE_WORKSTATION); emiRegistry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, VIRID_JADESTONE_FURNACE_WORKSTATION);
// } }
//} }

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