Skip to content

Commit

Permalink
feat: enable JEI integration
Browse files Browse the repository at this point in the history
  • Loading branch information
klikli-dev committed Jun 17, 2024
1 parent b3e35e6 commit e4d4fb1
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
9 changes: 4 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ sourceSets {
java {
exclude '**/AlmostUnifiedIntegrationImpl.java'
exclude '**/emi/**/*.java'
exclude '**/jei/impl/**/*.java'
// exclude '**/jei/impl/**/*.java'
exclude 'com/klikli_dev/occultism/common/item/tool/FamiliarRingItem.java'
}
}
Expand Down Expand Up @@ -126,11 +126,10 @@ repositories {
dependencies {
implementation "net.neoforged:neoforge:${neo_version}"

//TODO: enable once available
//Jei
// compileOnly "mezz.jei:jei-${minecraft_version}-common-api:${jei_version}"
// compileOnly "mezz.jei:jei-${minecraft_version}-neoforge-api:${jei_version}"
// runtimeOnly "mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}"
compileOnly "mezz.jei:jei-${minecraft_version}-common-api:${jei_version}"
compileOnly "mezz.jei:jei-${minecraft_version}-neoforge-api:${jei_version}"
runtimeOnly "mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}"

//curios
// compileOnly "top.theillusivec4.curios:curios-neoforge:${curios_version}+${minecraft_version}:api"
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ mod_authors=Kli Kli
mod_description=A magic mod inspired by the world of Jonathan Stroud's Bartimaeus. With the help of occult rituals players can summon entities from the "Other Side" to perform magic.

## Dependency Properties
jei_version=17.0.0.30
jei_version_range=[17.0.0.30,)
jei_version=19.0.0.1
jei_version_range=[19.0.0.1,)
curios_version=8.0.0-beta.4
curios_version_range=[8.0.0-beta.4,)
geckolib_minecraft_version=1.21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import mezz.jei.api.recipe.transfer.IRecipeTransferError;
import mezz.jei.api.recipe.transfer.IRecipeTransferHandler;
import mezz.jei.api.recipe.transfer.IRecipeTransferHandlerHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.network.chat.Component;
Expand Down Expand Up @@ -92,7 +93,7 @@ public CompoundTag recipeToNbt(AbstractContainerMenu container, IRecipeSlotsView
//if stack is not empty, write to result
ItemStack itemStack = possibleItems.get(i);
if (!itemStack.isEmpty()) {
invList.add(itemStack.saveOptional(new CompoundTag()));
invList.add(itemStack.saveOptional(Minecraft.getInstance().level.registryAccess()));
}
}
nbt.put("s" + (slot.getSlotIndex()), invList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
package com.klikli_dev.occultism.integration.jei.impl.recipes;

import com.klikli_dev.occultism.Occultism;
import com.klikli_dev.occultism.common.misc.WeightedOutputIngredient;
import com.klikli_dev.occultism.crafting.recipe.MinerRecipe;
import com.klikli_dev.occultism.crafting.recipe.input.ItemHandlerRecipeInput;
import com.klikli_dev.occultism.integration.jei.impl.JeiRecipeTypes;
import com.klikli_dev.occultism.registry.OccultismRecipes;
import com.klikli_dev.occultism.util.GuiGraphicsExt;
Expand Down Expand Up @@ -97,8 +97,8 @@ public void setRecipe(IRecipeLayoutBuilder builder, RecipeHolder<MinerRecipe> re
simulatedHandler.setStackInSlot(0, recipe.value().getIngredients().get(0).getItems()[0]);
var recipes = level.getRecipeManager()
.getRecipesFor(OccultismRecipes.MINER_TYPE.get(),
new RecipeWrapper(simulatedHandler), level);
List<WeightedOutputIngredient> possibleResults = recipes.stream().map(RecipeHolder::value).map(MinerRecipe::getWeightedResult).toList();
new ItemHandlerRecipeInput(simulatedHandler), level);
var possibleResults = recipes.stream().map(RecipeHolder::value).map(MinerRecipe::getWeightedResult).toList();

float chance = (float) recipe.value().getWeightedResult().getWeight().asInt()/100;
this.chances.put(recipe.value(), chance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public RitualRecipeCategory(IGuiHelper guiHelper) {
this.ritualCenterY = this.background.getHeight() / 2 - this.iconWidth / 2 + 20;
this.localizedName = Component.translatable(Occultism.MODID + ".jei.ritual");
this.pentacle = I18n.get(Occultism.MODID + ".jei.pentacle");
this.goldenSacrificialBowl.getOrCreateTag().putBoolean("RenderFull", true);
this.sacrificialBowl.getOrCreateTag().putBoolean("RenderFull", true);
// this.goldenSacrificialBowl.getOrCreateTag().putBoolean("RenderFull", true);
// this.sacrificialBowl.getOrCreateTag().putBoolean("RenderFull", true);
this.arrow = guiHelper.createDrawable(
ResourceLocation.fromNamespaceAndPath(Occultism.MODID, "textures/gui/jei/arrow.png"), 0, 0, 64, 46);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public SpiritFireRecipeCategory(IGuiHelper guiHelper) {
this.overlay = guiHelper.createDrawable(
ResourceLocation.fromNamespaceAndPath(Occultism.MODID, "textures/gui/jei/spirit_fire.png"), 0, 0, 64, 46);
this.icon = guiHelper.createDrawableIngredient(VanillaTypes.ITEM_STACK, this.renderStack);
this.renderStack.getOrCreateTag().putBoolean("RenderFull", true);
// this.renderStack.getOrCreateTag().putBoolean("RenderFull", true);
}

@Override
Expand Down

0 comments on commit e4d4fb1

Please sign in to comment.