diff --git a/build.gradle b/build.gradle index a7d98af..b7c5b9d 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ repositories { maven { url "https://maven.shedaniel.me/" } maven { url 'https://api.modrinth.com/maven' - content {includeGroup "maven.modrinth"} + content { includeGroup "maven.modrinth" } } maven { url 'https://jitpack.io' } mavenLocal() @@ -41,7 +41,8 @@ dependencies { modImplementation "io.wispforest:owo-lib:${project.owo_version}" include "io.wispforest:owo-sentinel:${project.owo_version}" - //modImplementation "dev.emi:emi:${project.emi_version}" + modCompileOnly "dev.emi:emi-fabric:${emi_version}:api" + modLocalRuntime "dev.emi:emi-fabric:${emi_version}" } loom { diff --git a/gradle.properties b/gradle.properties index 09b0022..11ef4e2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,25 +3,20 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/develop minecraft_base_version=1.20 -minecraft_version=1.20 -yarn_mappings=1.20+build.1 +minecraft_version=1.20.1 +yarn_mappings=1.20.1+build.9 loader_version=0.14.21 # Mod Properties -mod_version=2.0.21 +mod_version=2.0.22 maven_group=io.wispforest archives_base_name=alloy-forgery - # Dependencies fabric_version=0.83.0+1.20 - # https://maven.shedaniel.me/me/shedaniel/RoughlyEnoughItems-fabric/ rei_version=12.0.613 - # https://www.curseforge.com/minecraft/mc-mods/modmenu/files modmenu_version=7.0.0-beta.2 - # https://maven.wispforest.io/io/wispforest/owo-lib -owo_version=0.11.0+1.20 - +owo_version=0.11.1+1.20 # https://maven.terraformersmc.com/releases/dev/emi/emi -emi_version=0.7.2+1.19.4 +emi_version=1.0.8+1.20.1 diff --git a/src/main/java/wraith/alloyforgery/compat/emi/AlloyForgeryEmiPlugin.java b/src/main/java/wraith/alloyforgery/compat/emi/AlloyForgeryEmiPlugin.java index 51ec8d0..c7530b7 100644 --- a/src/main/java/wraith/alloyforgery/compat/emi/AlloyForgeryEmiPlugin.java +++ b/src/main/java/wraith/alloyforgery/compat/emi/AlloyForgeryEmiPlugin.java @@ -1,33 +1,32 @@ package wraith.alloyforgery.compat.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.stack.EmiStack; +import dev.emi.emi.api.EmiPlugin; +import dev.emi.emi.api.EmiRegistry; +import dev.emi.emi.api.recipe.EmiRecipeCategory; +import dev.emi.emi.api.stack.EmiStack; import net.minecraft.block.Block; import net.minecraft.util.Identifier; import wraith.alloyforgery.AlloyForgery; import wraith.alloyforgery.forges.ForgeRegistry; import wraith.alloyforgery.recipe.AlloyForgeRecipe; -public class AlloyForgeryEmiPlugin /*implements EmiPlugin*/ { +public class AlloyForgeryEmiPlugin implements EmiPlugin { -// private static final Identifier FORGE_ID = AlloyForgery.id("alloy_forge"); -// public static final EmiRecipeCategory FORGE_CATEGORY = new EmiRecipeCategory(FORGE_ID, EmiStack.of(ForgeRegistry.getControllerBlocks().get(0))); -// -// -// @Override -// public void register(EmiRegistry registry) { -// registry.addCategory(FORGE_CATEGORY); -// -// for (Block controller : ForgeRegistry.getControllerBlocks()) { -// registry.addWorkstation(FORGE_CATEGORY, EmiStack.of(controller)); -// } -// -// for (AlloyForgeRecipe recipe : registry.getRecipeManager().listAllOfType(AlloyForgeRecipe.Type.INSTANCE)) { -// registry.addRecipe(new AlloyForgeryEmiRecipe(recipe)); -// } -// -// registry.addRecipeHandler(AlloyForgery.ALLOY_FORGE_SCREEN_HANDLER_TYPE, new AlloyForgeryEmiRecipeHandler()); -// } + private static final Identifier FORGE_ID = AlloyForgery.id("alloy_forge"); + public static final EmiRecipeCategory FORGE_CATEGORY = new EmiRecipeCategory(FORGE_ID, EmiStack.of(ForgeRegistry.getControllerBlocks().get(0))); + + @Override + public void register(EmiRegistry registry) { + registry.addCategory(FORGE_CATEGORY); + + for (Block controller : ForgeRegistry.getControllerBlocks()) { + registry.addWorkstation(FORGE_CATEGORY, EmiStack.of(controller)); + } + + for (AlloyForgeRecipe recipe : registry.getRecipeManager().listAllOfType(AlloyForgeRecipe.Type.INSTANCE)) { + registry.addRecipe(new AlloyForgeryEmiRecipe(recipe)); + } + + registry.addRecipeHandler(AlloyForgery.ALLOY_FORGE_SCREEN_HANDLER_TYPE, new AlloyForgeryEmiRecipeHandler()); + } } diff --git a/src/main/java/wraith/alloyforgery/compat/emi/AlloyForgeryEmiRecipe.java b/src/main/java/wraith/alloyforgery/compat/emi/AlloyForgeryEmiRecipe.java index b11986b..3aece87 100644 --- a/src/main/java/wraith/alloyforgery/compat/emi/AlloyForgeryEmiRecipe.java +++ b/src/main/java/wraith/alloyforgery/compat/emi/AlloyForgeryEmiRecipe.java @@ -1,11 +1,10 @@ package wraith.alloyforgery.compat.emi; -//import dev.emi.emi.api.recipe.EmiRecipe; -//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.shedaniel.rei.api.client.gui.widgets.WidgetHolder; +import dev.emi.emi.api.recipe.EmiRecipe; +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 net.minecraft.item.ItemStack; import net.minecraft.recipe.Ingredient; import net.minecraft.text.OrderedText; @@ -17,138 +16,138 @@ import java.util.*; -public class AlloyForgeryEmiRecipe /*implements EmiRecipe*/ { - -// public AlloyForgeryEmiRecipe(AlloyForgeRecipe recipe) { -// this.id = recipe.getId(); -// -// //Convert inputs to a list of EMI Ingredients -// List convertedInputs = new ArrayList<>(); -// for (Map.Entry entry : recipe.getIngredientsMap().entrySet()) { -// for (int i = entry.getValue(); i > 0; ) { -// int stackCount = Math.min(i, 64); -// -// convertedInputs.add( -// EmiIngredient.of(Arrays.stream(entry.getKey().getMatchingStacks()) -// .map(ItemStack::copy) -// .peek(stack -> stack.setCount(stackCount)) -// .map(EmiStack::of) -// .toList())); -// -// i -= stackCount; -// } -// } -// this.inputs = convertedInputs; -// -// //tier and fuel same way as REI plugin -// this.minForgeTier = recipe.getMinForgeTier(); -// this.requiredFuel = recipe.getFuelPerTick(); -// -// //initialize the starting text and stack to show in the plugin -// this.currentTierText = Text.translatable("container.alloy_forgery.rei.min_tier", minForgeTier).asOrderedText(); -// this.currentStack = EmiStack.of(recipe.getOutput()); -// -// //set the outputs list with the initial stack -// this.outputs = List.of(currentStack); -// -// //re-mapping overrides to EmiStacks for rendering in slot widget -// Map tierOverrides = new HashMap<>(); -// for (Map.Entry entry : recipe.getTierOverrides().entrySet()) { -// tierOverrides.put(entry.getKey(), EmiStack.of(entry.getValue())); -// } -// this.overrides = tierOverrides; -// this.overridesKeys = overrides.keySet().stream().toList(); -// -// this.tierTextWidget = new CustomTextWidget(currentTierText, 8, 7, 0x404040, false); -// this.cycleTierWidget = new CustomButtonWidget(127, 2, () -> !overrides.isEmpty(), ((mouseX, mouseY, button) -> cycleStacks())); -// this.outputWidget = new CustomSlotWidget(currentStack, 104, 38, this); -// -// } -// -// static final Identifier GUI_TEXTURE = AlloyForgery.id("textures/gui/forge_controller.png"); -// -// private final Identifier id; -// private final List inputs; -// private final List outputs; -// private final int minForgeTier; -// private final int requiredFuel; -// private final Map overrides; -// private final List overridesKeys; -// private int currentIndex = 0; -// private OrderedText currentTierText; -// private EmiStack currentStack; -// private final CustomTextWidget tierTextWidget; -// private final CustomButtonWidget cycleTierWidget; -// private final CustomSlotWidget outputWidget; -// -// @Override -// public void addWidgets(WidgetHolder widgets) { -// //the min tier text -// widgets.add(tierTextWidget); -// -// //the fuel required text -// widgets.addText(Text.translatable("container.alloy_forgery.rei.fuel_per_tick", requiredFuel).asOrderedText(), 8, 20, 0x404040, false); -// -// //the ten input slots background -// widgets.addTexture(GUI_TEXTURE, 6, 34, 92, 38, 42, 41); -// widgets.addTexture(GUI_TEXTURE, 107, 14, 10, 10, 208, 30); -// widgets.addTexture(GUI_TEXTURE, 111, 17, 16, 20, 176, 0); -// -// //the input slots themselves -// for (int i = 0; i < inputs.size(); i++) { -// int x = 7 + i % 5 * 18; -// int y = 35 + i / 5 * 18; -// widgets.addTexture(GUI_TEXTURE, x, y, 18, 18, 208, 0); -// widgets.addSlot(inputs.get(i), x, y).drawBack(false); -// } -// -// //add the tier cycling button -// widgets.add(cycleTierWidget); -// widgets.add(outputWidget); -// } -// -// private void cycleStacks() { -// currentIndex++; -// if (currentIndex > overrides.size()) currentIndex = 0; -// if (currentIndex == 0) { -// currentTierText = Text.translatable("container.alloy_forgery.rei.min_tier", minForgeTier).asOrderedText(); -// currentStack = outputs.get(0); -// } else { -// AlloyForgeRecipe.OverrideRange range = overridesKeys.get(currentIndex - 1); -// currentTierText = Text.translatable("container.alloy_forgery.rei.min_tier", range).asOrderedText(); -// currentStack = overrides.get(range); -// } -// tierTextWidget.setText(currentTierText); -// outputWidget.setMutableStack(currentStack); -// } -// -// @Override -// public EmiRecipeCategory getCategory() { -// return AlloyForgeryEmiPlugin.FORGE_CATEGORY; -// } -// -// @Override -// public @Nullable Identifier getId() { -// return id; -// } -// -// @Override -// public List getInputs() { -// return inputs; -// } -// -// @Override -// public List getOutputs() { -// return outputs; -// } -// -// @Override -// public int getDisplayWidth() { -// return 142; -// } -// -// @Override -// public int getDisplayHeight() { -// return 78; -// } +public class AlloyForgeryEmiRecipe implements EmiRecipe { + + public AlloyForgeryEmiRecipe(AlloyForgeRecipe recipe) { + this.id = recipe.getId(); + + //Convert inputs to a list of EMI Ingredients + List convertedInputs = new ArrayList<>(); + for (Map.Entry entry : recipe.getIngredientsMap().entrySet()) { + for (int i = entry.getValue(); i > 0; ) { + int stackCount = Math.min(i, 64); + + convertedInputs.add( + EmiIngredient.of(Arrays.stream(entry.getKey().getMatchingStacks()) + .map(ItemStack::copy) + .peek(stack -> stack.setCount(stackCount)) + .map(EmiStack::of) + .toList())); + + i -= stackCount; + } + } + this.inputs = convertedInputs; + + //tier and fuel same way as REI plugin + this.minForgeTier = recipe.getMinForgeTier(); + this.requiredFuel = recipe.getFuelPerTick(); + + //initialize the starting text and stack to show in the plugin + this.currentTierText = Text.translatable("container.alloy_forgery.rei.min_tier", minForgeTier).asOrderedText(); + this.currentStack = EmiStack.of(recipe.getOutput()); + + //set the outputs list with the initial stack + this.outputs = List.of(currentStack); + + //re-mapping overrides to EmiStacks for rendering in slot widget + Map tierOverrides = new HashMap<>(); + for (Map.Entry entry : recipe.getTierOverrides().entrySet()) { + tierOverrides.put(entry.getKey(), EmiStack.of(entry.getValue())); + } + this.overrides = tierOverrides; + this.overridesKeys = overrides.keySet().stream().toList(); + + this.tierTextWidget = new CustomTextWidget(currentTierText, 8, 7, 0x404040, false); + this.cycleTierWidget = new CustomButtonWidget(127, 2, () -> !overrides.isEmpty(), ((mouseX, mouseY, button) -> cycleStacks())); + this.outputWidget = new CustomSlotWidget(currentStack, 104, 38, this); + + } + + static final Identifier GUI_TEXTURE = AlloyForgery.id("textures/gui/forge_controller.png"); + + private final Identifier id; + private final List inputs; + private final List outputs; + private final int minForgeTier; + private final int requiredFuel; + private final Map overrides; + private final List overridesKeys; + private int currentIndex = 0; + private OrderedText currentTierText; + private EmiStack currentStack; + private final CustomTextWidget tierTextWidget; + private final CustomButtonWidget cycleTierWidget; + private final CustomSlotWidget outputWidget; + + @Override + public void addWidgets(WidgetHolder widgets) { + //the min tier text + widgets.add(tierTextWidget); + + //the fuel required text + widgets.addText(Text.translatable("container.alloy_forgery.rei.fuel_per_tick", requiredFuel).asOrderedText(), 8, 20, 0x404040, false); + + //the ten input slots background + widgets.addTexture(GUI_TEXTURE, 6, 34, 92, 38, 42, 41); + widgets.addTexture(GUI_TEXTURE, 107, 14, 10, 10, 208, 30); + widgets.addTexture(GUI_TEXTURE, 111, 17, 16, 20, 176, 0); + + //the input slots themselves + for (int i = 0; i < inputs.size(); i++) { + int x = 7 + i % 5 * 18; + int y = 35 + i / 5 * 18; + widgets.addTexture(GUI_TEXTURE, x, y, 18, 18, 208, 0); + widgets.addSlot(inputs.get(i), x, y).drawBack(false); + } + + //add the tier cycling button + widgets.add(cycleTierWidget); + widgets.add(outputWidget); + } + + private void cycleStacks() { + currentIndex++; + if (currentIndex > overrides.size()) currentIndex = 0; + if (currentIndex == 0) { + currentTierText = Text.translatable("container.alloy_forgery.rei.min_tier", minForgeTier).asOrderedText(); + currentStack = outputs.get(0); + } else { + AlloyForgeRecipe.OverrideRange range = overridesKeys.get(currentIndex - 1); + currentTierText = Text.translatable("container.alloy_forgery.rei.min_tier", range).asOrderedText(); + currentStack = overrides.get(range); + } + tierTextWidget.setText(currentTierText); + outputWidget.setMutableStack(currentStack); + } + + @Override + public EmiRecipeCategory getCategory() { + return AlloyForgeryEmiPlugin.FORGE_CATEGORY; + } + + @Override + public @Nullable Identifier getId() { + return id; + } + + @Override + public List getInputs() { + return inputs; + } + + @Override + public List getOutputs() { + return outputs; + } + + @Override + public int getDisplayWidth() { + return 142; + } + + @Override + public int getDisplayHeight() { + return 78; + } } diff --git a/src/main/java/wraith/alloyforgery/compat/emi/AlloyForgeryEmiRecipeHandler.java b/src/main/java/wraith/alloyforgery/compat/emi/AlloyForgeryEmiRecipeHandler.java index cbc756f..6497325 100644 --- a/src/main/java/wraith/alloyforgery/compat/emi/AlloyForgeryEmiRecipeHandler.java +++ b/src/main/java/wraith/alloyforgery/compat/emi/AlloyForgeryEmiRecipeHandler.java @@ -1,7 +1,7 @@ package wraith.alloyforgery.compat.emi; -//import dev.emi.emi.api.EmiRecipeHandler; -//import dev.emi.emi.api.recipe.EmiRecipe; +import dev.emi.emi.api.recipe.EmiRecipe; +import dev.emi.emi.api.recipe.handler.StandardRecipeHandler; import net.minecraft.screen.slot.Slot; import org.jetbrains.annotations.Nullable; import wraith.alloyforgery.AlloyForgeScreenHandler; @@ -9,33 +9,33 @@ import java.util.ArrayList; import java.util.List; -public class AlloyForgeryEmiRecipeHandler /*implements EmiRecipeHandler*/ { -// @Override -// public List getInputSources(AlloyForgeScreenHandler handler) { -// List slots = new ArrayList<>(); -// for (int i = 0; i < handler.slots.size(); i++) { -// if (i < 2) continue; -// slots.add(handler.slots.get(i)); -// } -// return slots; -// } -// -// @Override -// public List getCraftingSlots(AlloyForgeScreenHandler handler) { -// List slots = new ArrayList<>(); -// for (int i = 2; i < 12; i++) { -// slots.add(handler.slots.get(i)); -// } -// return slots; -// } -// -// @Override -// public @Nullable Slot getOutputSlot(AlloyForgeScreenHandler handler) { -// return EmiRecipeHandler.super.getOutputSlot(handler); -// } -// -// @Override -// public boolean supportsRecipe(EmiRecipe recipe) { -// return recipe.getCategory() == AlloyForgeryEmiPlugin.FORGE_CATEGORY && recipe.supportsRecipeTree(); -// } +public class AlloyForgeryEmiRecipeHandler implements StandardRecipeHandler { + @Override + public List getInputSources(AlloyForgeScreenHandler handler) { + List slots = new ArrayList<>(); + for (int i = 0; i < handler.slots.size(); i++) { + if (i < 2) continue; + slots.add(handler.slots.get(i)); + } + return slots; + } + + @Override + public List getCraftingSlots(AlloyForgeScreenHandler handler) { + List slots = new ArrayList<>(); + for (int i = 2; i < 12; i++) { + slots.add(handler.slots.get(i)); + } + return slots; + } + + @Override + public @Nullable Slot getOutputSlot(AlloyForgeScreenHandler handler) { + return StandardRecipeHandler.super.getOutputSlot(handler); + } + + @Override + public boolean supportsRecipe(EmiRecipe recipe) { + return recipe.getCategory() == AlloyForgeryEmiPlugin.FORGE_CATEGORY && recipe.supportsRecipeTree(); + } } diff --git a/src/main/java/wraith/alloyforgery/compat/emi/CustomButtonWidget.java b/src/main/java/wraith/alloyforgery/compat/emi/CustomButtonWidget.java index 86896ba..3e42782 100644 --- a/src/main/java/wraith/alloyforgery/compat/emi/CustomButtonWidget.java +++ b/src/main/java/wraith/alloyforgery/compat/emi/CustomButtonWidget.java @@ -1,65 +1,62 @@ package wraith.alloyforgery.compat.emi; import com.mojang.blaze3d.systems.RenderSystem; -//import dev.emi.emi.EmiPort; -//import dev.emi.emi.api.widget.Bounds; -//import dev.emi.emi.api.widget.ButtonWidget; -//import dev.emi.emi.api.widget.Widget; +import dev.emi.emi.api.widget.Bounds; +import dev.emi.emi.api.widget.ButtonWidget; +import dev.emi.emi.api.widget.Widget; import net.minecraft.client.MinecraftClient; -//import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.tooltip.TooltipComponent; import net.minecraft.client.sound.PositionedSoundInstance; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.sound.SoundEvents; import net.minecraft.text.Text; import java.util.List; import java.util.function.BooleanSupplier; -public class CustomButtonWidget /*extends Widget*/ { +public class CustomButtonWidget extends Widget { -// private final int x, y; -// private final BooleanSupplier isActive; -// private final ButtonWidget.ClickAction action; -// private final List tooltipComponent = List.of(TooltipComponent.of(Text.translatable("container.alloy_forgery.rei.button").asOrderedText())); -// -// public CustomButtonWidget(int x, int y, BooleanSupplier isActive, ButtonWidget.ClickAction action) { -// this.x = x; -// this.y = y; -// this.isActive = isActive; -// this.action = action; -// } -// -// @Override -// public Bounds getBounds() { -// return new Bounds(x, y, 12, 12); -// } -// -// @Override -// public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { -// EmiPort.setPositionTexShader(); -// RenderSystem.setShaderTexture(0, AlloyForgeryEmiRecipe.GUI_TEXTURE); -// int v = 68; -// boolean active = this.isActive.getAsBoolean(); -// if (!active) { -// v += 24; -// } else if (getBounds().contains(mouseX, mouseY)) { -// v += 12; -// } -// RenderSystem.enableDepthTest(); -// DrawableHelper.drawTexture(matrices, this.x, this.y, 176, v, 12, 12, 256, 256); -// } -// -// @Override -// public boolean mouseClicked(int mouseX, int mouseY, int button) { -// if (!isActive.getAsBoolean()) return false; -// action.click(mouseX, mouseY, button); -// MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0f)); -// return true; -// } -// -// @Override -// public List getTooltip(int mouseX, int mouseY) { -// return tooltipComponent; -// } + private final int x, y; + private final BooleanSupplier isActive; + private final ButtonWidget.ClickAction action; + private final List tooltipComponent = List.of(TooltipComponent.of(Text.translatable("container.alloy_forgery.rei.button").asOrderedText())); + + public CustomButtonWidget(int x, int y, BooleanSupplier isActive, ButtonWidget.ClickAction action) { + this.x = x; + this.y = y; + this.isActive = isActive; + this.action = action; + } + + @Override + public Bounds getBounds() { + return new Bounds(x, y, 12, 12); + } + + @Override + public void render(DrawContext context, int mouseX, int mouseY, float delta) { + RenderSystem.setShaderTexture(0, AlloyForgeryEmiRecipe.GUI_TEXTURE); + int v = 68; + boolean active = this.isActive.getAsBoolean(); + if (!active) { + v += 24; + } else if (getBounds().contains(mouseX, mouseY)) { + v += 12; + } + RenderSystem.enableDepthTest(); + context.drawTexture(AlloyForgeryEmiRecipe.GUI_TEXTURE, this.x, this.y, 176, v, 12, 12, 256, 256); + } + + @Override + public boolean mouseClicked(int mouseX, int mouseY, int button) { + if (!isActive.getAsBoolean()) return false; + action.click(mouseX, mouseY, button); + MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0f)); + return true; + } + + @Override + public List getTooltip(int mouseX, int mouseY) { + return tooltipComponent; + } } diff --git a/src/main/java/wraith/alloyforgery/compat/emi/CustomSlotWidget.java b/src/main/java/wraith/alloyforgery/compat/emi/CustomSlotWidget.java index 267276e..95aa5d7 100644 --- a/src/main/java/wraith/alloyforgery/compat/emi/CustomSlotWidget.java +++ b/src/main/java/wraith/alloyforgery/compat/emi/CustomSlotWidget.java @@ -1,26 +1,26 @@ package wraith.alloyforgery.compat.emi; -//import dev.emi.emi.api.recipe.EmiRecipe; -//import dev.emi.emi.api.stack.EmiIngredient; -//import dev.emi.emi.api.widget.SlotWidget; +import dev.emi.emi.api.recipe.EmiRecipe; +import dev.emi.emi.api.stack.EmiIngredient; +import dev.emi.emi.api.widget.SlotWidget; -public class CustomSlotWidget /*extends SlotWidget*/ { +public class CustomSlotWidget extends SlotWidget { -// public CustomSlotWidget(EmiIngredient stack, int x, int y, EmiRecipe recipe) { -// super(stack, x, y); -// this.mutableStack = stack; -// this.output = true; -// this.recipeContext(recipe); -// } -// -// private EmiIngredient mutableStack; -// -// public void setMutableStack(EmiIngredient stack) { -// this.mutableStack = stack; -// } -// -// @Override -// public EmiIngredient getStack() { -// return mutableStack; -// } + public CustomSlotWidget(EmiIngredient stack, int x, int y, EmiRecipe recipe) { + super(stack, x, y); + this.mutableStack = stack; + this.output = true; + this.recipeContext(recipe); + } + + private EmiIngredient mutableStack; + + public void setMutableStack(EmiIngredient stack) { + this.mutableStack = stack; + } + + @Override + public EmiIngredient getStack() { + return mutableStack; + } } diff --git a/src/main/java/wraith/alloyforgery/compat/emi/CustomTextWidget.java b/src/main/java/wraith/alloyforgery/compat/emi/CustomTextWidget.java index 3daf984..e542a62 100644 --- a/src/main/java/wraith/alloyforgery/compat/emi/CustomTextWidget.java +++ b/src/main/java/wraith/alloyforgery/compat/emi/CustomTextWidget.java @@ -1,13 +1,13 @@ package wraith.alloyforgery.compat.emi; -//import dev.emi.emi.api.widget.Bounds; -//import dev.emi.emi.api.widget.TextWidget; -//import dev.emi.emi.api.widget.Widget; +import dev.emi.emi.api.widget.Bounds; +import dev.emi.emi.api.widget.TextWidget; +import dev.emi.emi.api.widget.Widget; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.gui.DrawContext; import net.minecraft.text.OrderedText; -public class CustomTextWidget /*extends Widget*/ { +public class CustomTextWidget extends Widget { private static final MinecraftClient CLIENT = MinecraftClient.getInstance(); private OrderedText text; private final int x, y; @@ -26,26 +26,23 @@ public void setText(OrderedText text) { this.text = text; } -// @Override -// public Bounds getBounds() { -// int width = CLIENT.textRenderer.getWidth(text); -// int xOff = TextWidget.Alignment.START.offset(width); -// int yOff = TextWidget.Alignment.START.offset(CLIENT.textRenderer.fontHeight); -// return new Bounds(x + xOff, y + yOff, width, CLIENT.textRenderer.fontHeight); -// } -// -// @Override -// public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { -// matrices.push(); -// int xOff = TextWidget.Alignment.START.offset(CLIENT.textRenderer.getWidth(text)); -// int yOff = TextWidget.Alignment.START.offset(CLIENT.textRenderer.fontHeight); -// matrices.translate(xOff, yOff, 300); -// if (shadow) { -// CLIENT.textRenderer.drawWithShadow(matrices, text, x, y, color); -// } else { -// CLIENT.textRenderer.draw(matrices, text, x, y, color); -// } -// matrices.pop(); -// } + @Override + public Bounds getBounds() { + int width = CLIENT.textRenderer.getWidth(text); + int xOff = TextWidget.Alignment.START.offset(width); + int yOff = TextWidget.Alignment.START.offset(CLIENT.textRenderer.fontHeight); + return new Bounds(x + xOff, y + yOff, width, CLIENT.textRenderer.fontHeight); + } + + @Override + public void render(DrawContext context, int mouseX, int mouseY, float delta) { + var matrices = context.getMatrices(); + matrices.push(); + int xOff = TextWidget.Alignment.START.offset(CLIENT.textRenderer.getWidth(text)); + int yOff = TextWidget.Alignment.START.offset(CLIENT.textRenderer.fontHeight); + matrices.translate(xOff, yOff, 300); + context.drawText(CLIENT.textRenderer, text, x, y, color, shadow); + matrices.pop(); + } } diff --git a/src/main/resources/assets/alloy_forgery/lang/en_us.json b/src/main/resources/assets/alloy_forgery/lang/en_us.json index 6465b70..476320d 100644 --- a/src/main/resources/assets/alloy_forgery/lang/en_us.json +++ b/src/main/resources/assets/alloy_forgery/lang/en_us.json @@ -23,5 +23,9 @@ "itemGroup.alloy_forgery.alloy_forgery.button.modrinth": "Modrinth", "itemGroup.alloy_forgery.alloy_forgery.button.github": "GitHub", - "emi.category.alloy_forgery.alloy_forge": "Alloy Forging" + "emi.category.alloy_forgery.alloy_forge": "Alloy Forging", + + "tag.item.c.gold_ores": "Gold Ores", + "tag.item.c.raw_gold_ore_blocks": "Raw Gold Ore Blocks", + "tag.item.c.raw_iron_ore_blocks": "Raw Iron Ore Blocks" } \ No newline at end of file diff --git a/src/main/resources/assets/alloy_forgery/textures/gui/forge_controller.png b/src/main/resources/assets/alloy_forgery/textures/gui/forge_controller.png index ce64e3d..526ebeb 100644 Binary files a/src/main/resources/assets/alloy_forgery/textures/gui/forge_controller.png and b/src/main/resources/assets/alloy_forgery/textures/gui/forge_controller.png differ diff --git a/src/main/resources/assets/alloy_forgery/textures/gui/forge_controller_dark.png b/src/main/resources/assets/alloy_forgery/textures/gui/forge_controller_dark.png index fd29e4b..a25618a 100644 Binary files a/src/main/resources/assets/alloy_forgery/textures/gui/forge_controller_dark.png and b/src/main/resources/assets/alloy_forgery/textures/gui/forge_controller_dark.png differ diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 46e0381..c6e2208 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -36,7 +36,7 @@ "rei_common": [ "wraith.alloyforgery.compat.rei.AlloyForgeryCommonPlugin" ], - "_emi": [ + "emi": [ "wraith.alloyforgery.compat.emi.AlloyForgeryEmiPlugin" ] }, @@ -54,7 +54,7 @@ "mythicmetals": "*" }, "recommends": { - "roughlyenoughitems": ">=12.0.0" + "roughlyenoughitems": ">=12.0.0" }, "custom": { "modmenu": {