Skip to content

Commit

Permalink
fix: jei ritual recipe item to use render x/y position
Browse files Browse the repository at this point in the history
  • Loading branch information
klikli-dev committed Jun 3, 2023
1 parent 7ce71bd commit 22de4f9
Showing 1 changed file with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,17 +191,35 @@ public void setRecipe(IRecipeLayoutBuilder builder, RitualRecipe recipe, IFocusG
builder.addSlot(RecipeIngredientRole.OUTPUT, 0, 0)
.addItemStack(recipe.getRitualDummy());



//draw item to use
if (recipe.requiresItemUse()) {
//first simulate the info rendering to get the right render position

int infotextY = 0;

int lineHeight = Minecraft.getInstance().font.lineHeight;
var pentacle = ModonomiconAPI.get().getMultiblock(recipe.getPentacleId());

//simulate pentacle id rendering, to get the correct Y level to draw at
if (pentacle != null) {
var pentacleName = Minecraft.getInstance().font.split( Component.translatable(Util.makeDescriptionId("multiblock", pentacle.getId())), 150);

for(var line : pentacleName){
//Don't actually draw
//this.drawStringCentered(poseStack, Minecraft.getInstance().font, line , infoTextX, infotextY);
infotextY += lineHeight;
}
}

//also simulate the info rendered before the item to use for the y level.
if (recipe.requiresSacrifice()) {
infotextY += 10;
infotextY += lineHeight;
}

infotextY += 10;
int itemToUseY = infotextY - 5;
int itemToUseX = this.getStringCenteredMaxX(Minecraft.getInstance().font, Component.translatable("jei.occultism.item_to_use"), 84, infotextY);
int infoTextX = 94;
int itemToUseX = this.getStringCenteredMaxX(Minecraft.getInstance().font, Component.translatable("jei.occultism.item_to_use"), infoTextX, infotextY);

builder.addSlot(RecipeIngredientRole.CATALYST, itemToUseX, itemToUseY)
.addIngredients(recipe.getItemToUse());
Expand Down

0 comments on commit 22de4f9

Please sign in to comment.