-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4db957e
commit db6039b
Showing
8 changed files
with
273 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+722 Bytes
.../resources/assets/hibernalherbs/textures/gui/recipe_viewer/emi/sprite_sheet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...ain/java/net/dakotapride/hibernalHerbs/common/integration/emi/EmiHibernalHerbsPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package net.dakotapride.hibernalHerbs.common.integration.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.render.EmiTexture; | ||
import dev.emi.emi.api.stack.EmiStack; | ||
import net.dakotapride.hibernalHerbs.common.init.BlockInit; | ||
import net.dakotapride.hibernalHerbs.common.init.RecipeInit; | ||
import net.dakotapride.hibernalHerbs.common.recipe.HerbalConjurationRecipe; | ||
import net.minecraft.recipe.RecipeManager; | ||
import net.minecraft.util.Identifier; | ||
|
||
import static net.dakotapride.hibernalHerbs.common.Constants.MOD_ID; | ||
|
||
public class EmiHibernalHerbsPlugin implements EmiPlugin { | ||
public static final Identifier SPRITE_SHEET = new Identifier(MOD_ID, "textures/gui/recipe_viewer/emi/sprite_sheet.png"); | ||
public static final EmiStack CONJURATION_ALTAR = EmiStack.of(BlockInit.CONJURATION_ALTAR); | ||
public static final EmiRecipeCategory CONJURATION_CATEGORY | ||
= new EmiRecipeCategory(new Identifier(MOD_ID, "herbal_conjuration"), CONJURATION_ALTAR, new EmiTexture(SPRITE_SHEET, 0, 0, 16, 16)); | ||
|
||
@Override | ||
public void register(EmiRegistry registry) { | ||
// Tell EMI to add a tab for your category | ||
registry.addCategory(CONJURATION_CATEGORY); | ||
|
||
// Add all the workstations your category uses | ||
registry.addWorkstation(CONJURATION_CATEGORY, CONJURATION_ALTAR); | ||
|
||
RecipeManager manager = registry.getRecipeManager(); | ||
|
||
// Use vanilla's concept of your recipes and pass them to your EmiRecipe representation | ||
for (HerbalConjurationRecipe recipe : manager.listAllOfType(RecipeInit.HERBAL_CONJURATION_TYPE)) { | ||
registry.addRecipe(new HerbalConjurationEmiRecipe(recipe)); | ||
} | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
...java/net/dakotapride/hibernalHerbs/common/integration/emi/HerbalConjurationEmiRecipe.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package net.dakotapride.hibernalHerbs.common.integration.emi; | ||
|
||
import dev.emi.emi.api.recipe.EmiRecipe; | ||
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.WidgetHolder; | ||
import me.shedaniel.math.Point; | ||
import me.shedaniel.rei.api.client.gui.widgets.Widget; | ||
import me.shedaniel.rei.api.client.gui.widgets.Widgets; | ||
import net.dakotapride.hibernalHerbs.common.recipe.HerbalConjurationRecipe; | ||
import net.minecraft.registry.DynamicRegistryManager; | ||
import net.minecraft.util.Identifier; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class HerbalConjurationEmiRecipe implements EmiRecipe { | ||
private final Identifier id; | ||
private final List<EmiIngredient> input; | ||
private final List<EmiStack> output; | ||
|
||
public HerbalConjurationEmiRecipe(HerbalConjurationRecipe recipe) { | ||
this.id = recipe.getId(); | ||
this.input = List.of( | ||
EmiIngredient.of(recipe.getIngredients().get(5)),EmiIngredient.of(recipe.getIngredients().get(0)), | ||
EmiIngredient.of(recipe.getIngredients().get(1)),EmiIngredient.of(recipe.getIngredients().get(2)), | ||
EmiIngredient.of(recipe.getIngredients().get(3)),EmiIngredient.of(recipe.getIngredients().get(4))); | ||
this.output = List.of(EmiStack.of(recipe.getOutput(DynamicRegistryManager.EMPTY))); | ||
} | ||
|
||
@Override | ||
public EmiRecipeCategory getCategory() { | ||
return EmiHibernalHerbsPlugin.CONJURATION_CATEGORY; | ||
} | ||
|
||
@Override | ||
public Identifier getId() { | ||
return id; | ||
} | ||
|
||
@Override | ||
public List<EmiIngredient> getInputs() { | ||
return input; | ||
} | ||
|
||
@Override | ||
public List<EmiStack> getOutputs() { | ||
return output; | ||
} | ||
|
||
@Override | ||
public int getDisplayWidth() { | ||
return 110; | ||
} | ||
|
||
@Override | ||
public int getDisplayHeight() { | ||
return 40; | ||
} | ||
|
||
@Override | ||
public void addWidgets(WidgetHolder widgets) { | ||
// Add an arrow texture to indicate processing | ||
widgets.addTexture(EmiTexture.EMPTY_ARROW, 63, 11); | ||
|
||
// Adds an input slot on the left | ||
widgets.addSlot(input.get(0), 3, 21); | ||
widgets.addSlot(input.get(1), 23, 21); | ||
widgets.addSlot(input.get(2), 43, 21); | ||
widgets.addSlot(input.get(3), 3, 1); | ||
widgets.addSlot(input.get(4), 23, 1); | ||
widgets.addSlot(input.get(5), 43, 1); | ||
|
||
// 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), 90, 11).recipeContext(this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters