#Show / Hide items in JEI

18 messages · Page 1 of 1 (latest)

unborn peak
#

My question is 2 parts:

1st, is there a simple method to hide all items, initially in JEI?

2nd, How would I go about then showing those hidden items based on data received from the server?

I'm creating arrays of items that I want to un-hide when the server sends data to the client. I've found examples to accomplish this for previous versions, but a lot seems to have changed for 1.19+, and I'm not familiar enough with javascript to translate them.

hybrid dewBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

lone mountain
unborn peak
#

that points me in the right direction. At the end of that thread, the OP was using a FTBQuestsEvents.completed() is that an addon?

unborn peak
#

Also, RecipeManager.... is there any documentation on that? I'm less looking to gate individual recipes and more wanting to gate all recipes for a given item.

unborn peak
#

Bumping this as it's been about a week and I'm still looking for info. It seems like RecipeManager in the linked thread can do what I need, but I'd like to avoid having to granularly hide/show each recipe ID and instead just hide/show the item itself.

If there's any documentation for it that I can reference, that'd be great.

unborn peak
#

I may be wrong, but it seems like that script is working with the JEI API. If that's the case, then it seems like IngredientManager would better suit my needs, and I've gone through the API, so if that's indeed correct I can move from here.

unborn peak
#

So, I'll chalk it up to not knowing javascript well enough, but I am making no progress at trying to hide/show items during runtime outside of the linked method which is specific recipe IDs. Is there a method to show/hide all recipes for a given item during runtime?

lone mountain
#

Post your latest code if you need feedback. It makes it easier for people to help if they can see what you're doing.

unborn peak
#
let jeiShowItem = function(item) {
    
    const IngredientManager = global.jeiRuntime.ingredientManager
    let IngredientUID = IngredientManager.getIngredientByUid(item)
    let ingredientType = IngredientManager.getIngredientTypeChecked(IngredientUID)

    IngredientManager.addIngredientsAtRuntime(ingredientType, item)

}```
This is the function I was trying to use to add the items to JEI, and the corresponding removeIngredientsAtRuntime() to remove them.
These functions are wanting a different data type, it seems, based on the error messages showing up in the logs.
small venture
unborn peak
#

It's not working at all... Hence why I was trying to get help

small venture
#

But you are trying to get items to hide or show on a certain event right?

unborn peak
#

Yeah

small venture
#

This is what you are looking for, if you could help me get it to work on liquids hahaha

thorn daggerBOT
#

[➤](#1223741772698746932 message)
i now got this script running: ```js
const $VanillaTypes = Java.loadClass('mezz.jei.api.constants.VanillaTypes')
const $ForgeTypes = Java.loadClass('mezz.jei.api.forge.ForgeTypes')
//global.jeiRuntime.getIngredientManager().removeIngredientsAtRuntime($VanillaTypes.ITEM_STACK, [Item.of('minecraft:apple')])

NetworkEvents.dataReceived('channel1', event => {
console.log('####### Data Received! #######')
event.player.tell('Data Received! SHOW')
event.player.playSound('entity.experience_orb.pickup')
global.jeiRuntime.getIngredientManager().addIngredientsAtRuntime($VanillaTypes.ITEM_STACK, [Item.of('minecraft:apple')])
global.jeiRuntime.getIngredientManager().addIngredientsAtRuntime($ForgeTypes.FLUID_STACK, [Item.of('minecraft:water')])
})

unborn peak
#

Ah, that's great! I appreciate it. I had put my pack on hold, but this opens the door to continue. I'll see what I can figure out this evening when I get home.

small venture
#

Glad i once could help (: , usually im the one looking for it