diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiVillagerRecipe.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiVillagerRecipe.java index 88871f11..4bbb4953 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiVillagerRecipe.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiVillagerRecipe.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.fabric.interop.emi; -import dev.emi.emi.EmiRenderHelper; import dev.emi.emi.api.recipe.EmiRecipe; +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.WidgetHolder; @@ -62,8 +62,8 @@ public abstract class EmiVillagerRecipe implements EmiRecipe { } public void addWidgets(WidgetHolder widgets) { - widgets.addTexture(EmiRenderHelper.WIDGETS, 27, 3, 13, 13, 82, 0); - widgets.addTexture(EmiRenderHelper.WIDGETS, 75, 1, 24, 17, 44, 0); + widgets.addTexture(EmiTexture.PLUS, 27, 3); + widgets.addTexture(EmiTexture.EMPTY_ARROW, 75, 1); widgets.addSlot(this.input, 0, 0); widgets.addSlot(this.catalyst, 49, 0).catalyst(this.isCatalyst); widgets.addSlot(this.result, 107, 0).recipeContext(this); diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java index 0bb4e181..b8214f64 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java @@ -5,13 +5,12 @@ import at.petrak.hexcasting.common.recipe.BrainsweepRecipe; import at.petrak.hexcasting.common.recipe.HexRecipeSerializers; import at.petrak.hexcasting.common.recipe.ingredient.VillagerIngredient; import at.petrak.hexcasting.mixin.accessor.AccessorPoiType; -import com.mojang.blaze3d.systems.RenderSystem; 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.EmiIngredient; import dev.emi.emi.api.stack.EmiStack; -import net.minecraft.client.gui.GuiComponent; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.ai.village.poi.PoiType; @@ -37,22 +36,16 @@ public class HexEMIPlugin implements EmiPlugin { private static final ResourceLocation SIMPLIFIED_ICON_PROFESSION = modLoc("textures/gui/villager_profession.png"); public static final EmiRecipeCategory BRAINSWEEP = new EmiRecipeCategory(BRAINSWEEP_ID, - new PatternRendererEMI(BRAINSWEEP_ID, 16, 16), (matrices, x, y, delta) -> { - RenderSystem.setShaderTexture(0, SIMPLIFIED_ICON_BRAINSWEEP); - GuiComponent.blit(matrices, x, y, 0, 0, 16, 16, 16, 16); - }); + new PatternRendererEMI(BRAINSWEEP_ID, 16, 16), + new EmiTexture(SIMPLIFIED_ICON_BRAINSWEEP, 0, 0, 16, 16, 16, 16, 16, 16)); public static final EmiRecipeCategory VILLAGER_LEVELING = new EmiRecipeCategory(VILLAGER_LEVELING_ID, - EmiStack.of(Items.EMERALD), (matrices, x, y, delta) -> { - RenderSystem.setShaderTexture(0, SIMPLIFIED_ICON_LEVELING); - GuiComponent.blit(matrices, x, y, 0, 0, 16, 16, 16, 16); - }); + EmiStack.of(Items.EMERALD), + new EmiTexture(SIMPLIFIED_ICON_LEVELING, 0, 0, 16, 16, 16, 16, 16, 16)); public static final EmiRecipeCategory VILLAGER_PROFESSION = new EmiRecipeCategory(VILLAGER_PROFESSION_ID, - EmiStack.of(Blocks.GRINDSTONE), (matrices, x, y, delta) -> { - RenderSystem.setShaderTexture(0, SIMPLIFIED_ICON_PROFESSION); - GuiComponent.blit(matrices, x, y, 0, 0, 16, 16, 16, 16); - }); + EmiStack.of(Blocks.LECTERN), + new EmiTexture(SIMPLIFIED_ICON_PROFESSION, 0, 0, 16, 16, 16, 16, 16, 16)); @Override public void register(EmiRegistry registry) { @@ -63,7 +56,7 @@ public class HexEMIPlugin implements EmiPlugin { for (BrainsweepRecipe recipe : registry.getRecipeManager().getAllRecipesFor(HexRecipeSerializers.BRAINSWEEP_TYPE)) { var inputs = EmiIngredient.of(recipe.blockIn().getDisplayedStacks().stream() - .map(EmiStack::of).toList()); + .map(EmiStack::of).toList()); var villagerInput = VillagerEmiStack.atLevelOrHigher(recipe.villagerIn(), true); var output = EmiStack.of(recipe.result().getBlock()); registry.addRecipe(new EmiBrainsweepRecipe(inputs, villagerInput, output, recipe.getId())); @@ -80,18 +73,18 @@ public class HexEMIPlugin implements EmiPlugin { Set states = ((AccessorPoiType) poi).hex$matchingStates(); if (!states.isEmpty()) { List workstations = states.stream() - .map(BlockState::getBlock) - .map(Block::asItem) - .distinct() - .filter((it) -> it != Items.AIR) - .toList(); + .map(BlockState::getBlock) + .map(Block::asItem) + .distinct() + .filter((it) -> it != Items.AIR) + .toList(); if (!workstations.isEmpty()) { registry.addWorkstation(VILLAGER_LEVELING, EmiIngredient.of(workstations.stream().map(EmiStack::of).toList())); registry.addWorkstation(VILLAGER_PROFESSION, EmiIngredient.of(workstations.stream().map(EmiStack::of).toList())); registry.addRecipe(new EmiProfessionRecipe(new VillagerEmiStack(basicVillager), - EmiIngredient.of(workstations.stream().map(EmiStack::of).toList()), - new VillagerEmiStack(manWithJob), poiRecipeId)); + EmiIngredient.of(workstations.stream().map(EmiStack::of).toList()), + new VillagerEmiStack(manWithJob), poiRecipeId)); for (int lvl = 1; lvl < 5; lvl++) { ResourceLocation levelRecipeId = modLoc("villager/levelup/" + lvl + "/" + id.getNamespace() + "/" + id.getPath()); diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/PatternRendererEMI.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/PatternRendererEMI.java index 4c4552ac..5731573d 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/PatternRendererEMI.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/PatternRendererEMI.java @@ -6,13 +6,13 @@ import at.petrak.hexcasting.interop.utils.PatternDrawingUtil; import at.petrak.hexcasting.interop.utils.PatternEntry; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.datafixers.util.Pair; -import dev.emi.emi.api.recipe.EmiRecipeCategory; +import dev.emi.emi.api.render.EmiRenderable; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.phys.Vec2; import java.util.List; -public class PatternRendererEMI implements EmiRecipeCategory.Renderer { +public class PatternRendererEMI implements EmiRenderable { private final long startTime = System.currentTimeMillis(); diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/TheCoolerSlotWidget.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/TheCoolerSlotWidget.java index c62b50db..dcff67bb 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/TheCoolerSlotWidget.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/TheCoolerSlotWidget.java @@ -2,8 +2,8 @@ package at.petrak.hexcasting.fabric.interop.emi; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; -import dev.emi.emi.EmiRenderHelper; -import dev.emi.emi.api.EmiRender; +import dev.emi.emi.api.render.EmiRender; +import dev.emi.emi.api.render.EmiTexture; import dev.emi.emi.api.stack.EmiIngredient; import dev.emi.emi.api.widget.Bounds; import dev.emi.emi.api.widget.SlotWidget; @@ -46,11 +46,10 @@ public class TheCoolerSlotWidget extends SlotWidget { RenderSystem.setShaderTexture(0, this.textureId); GuiComponent.blit(poseStack, bounds.x(), bounds.y(), width, height, (float)this.u, (float)this.v, width, height, 256, 256); } else { - RenderSystem.setShaderTexture(0, EmiRenderHelper.WIDGETS); if (this.output) { - GuiComponent.blit(poseStack, bounds.x(), bounds.y(), 26, 26, 18.0F, 0.0F, 26, 26, 256, 256); + EmiTexture.LARGE_SLOT.render(poseStack, bounds.x(), bounds.y(), delta); } else { - GuiComponent.blit(poseStack, bounds.x(), bounds.y(), 18, 18, 0.0F, 0.0F, 18, 18, 256, 256); + EmiTexture.SLOT.render(poseStack, bounds.x(), bounds.y(), delta); } } }