#Jei Hide with KubeJS not working

114 messages · Page 1 of 1 (latest)

south grove
#

I cant get the item to be hidden when putting it in the client scripts with:

// priority: 0

console.info('Hello, World! (You will see this line every time client resources reload)')

JEIEvents.hideItems(event => {
    // Hide items in JEI here
    // event.hide('minecraft:cobblestone')
    event.hide('#forge:ingots/enderium')
})
cerulean kestrelBOT
#

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

rich gust
#

i don't think jei hiding is intended to work with tags

south grove
#

tried with cobblestone

rich gust
#

try with a valid item again and send script/logs

fluid mauveBOT
#

Paste version of latest.log from @south grove

rich gust
#

the kubejs log bruh

#

also can you show the actual script too ?

south grove
#

where can i find the kubejs log

rich gust
#

logs/kubejs

south grove
#

is there not a command to make it pop up?

#
// priority: 0

console.info('Hello, World! (You will see this line every time client resources reload)')

JEIEvents.hideItems(event => {
    // Hide items in JEI here
    // event.hide('minecraft:cobblestone')
    event.hide('minecraft:cobblestone')
})
fluid mauveBOT
#

Paste version of client.txt, server.txt, startup.txt from @south grove

quasi pebble
#

put a console.log inside the event
is it firing?

south grove
#

how do i do that?
what should i paste in for console.log event

#

im new and coming from the craft tweaker system

quasi pebble
#

copy the existing console.log inside the events curly brackets

#

the event is the JEIEvents.hideItems bit

south grove
#
// priority: 0

console.info('Hello, World! (You will see this line every time client resources reload)')

JEIEvents.hideItems(event => {
    console.info('Hello, World! (You will see this line every time client resources reload)')
    // Hide items in JEI here
    // event.hide('minecraft:cobblestone')
    event.hide('minecraft:cobblestone')
})

like this?

fluid mauveBOT
#

Paste version of client.txt, server.txt, startup.txt from @south grove

quasi pebble
#

yes

#

so the event isnt firing

#

how are you reloading

fluid mauveBOT
#

Someone meant to type /reload.

south grove
#

/reload

rich gust
#

reload is for datapack

simple palm
#

you do have to /kubejs reload client_scripts first when making changes there

#

reload still fires off a jei update

south grove
#

ahhh, cause it was working for removing recipes when doing /reload

simple palm
#

sometimes I feel like /reload is faster than f3 + t

rich gust
#

removing recipes is data, hiding items in jei isnt

simple palm
#

yes because /reload reloads anything in the server_scripts folder

quasi pebble
#

or just f3 + t, which reloads client scripts and refires the jei event together (tho it can take ages for large packs, so often reloading client then all is better)

rich gust
#

i always use f3 + t, the other methods don't work all the time

south grove
#

ahhhh

#

so it worked, but is there a way to make it work for tags?

quasi pebble
#

no

rich gust
#

use foreaches to hide a lot of items

quasi pebble
#

tags kinda dont exist when the jei event is firing

south grove
#

also, when i loaded into the world after reloading the game, the recipes that i removed were no longer removed. i had to /reload the game upon joining for it to affect them

south grove
rich gust
#

js foreach

#

to hide a large list of items from x mod for example

quasi pebble
simple palm
#

last I checked tags are still borked on first load

quasi pebble
#
let list = ['minecraft:apple','minecraft:diamond')
list.forEach(item => {
  console.log(item)
})
#

that will log each item in the list

south grove
south grove
quasi pebble
#

using forEach

rich gust
south grove
#

yep

rich gust
#

you can also check kubejs scripts from other packs

south grove
#

i used crafttweaker before

rich gust
#

ah yea, believe me js is 1000x easier than their weird language

#

and it's like the #1 language in the world too

south grove
#

they dont have the bug for tags on first load though 😉

#

how can i make that work?

rich gust
#

i don't know that bug

#

i'm also still using 1.18 so can't help with this, sorry

quasi pebble
#

or not use tags for now

south grove
#

bummer

rich gust
quasi pebble
#

bclib sucks

rich gust
#

yes

#

but i like better end so i just ignore the pain of recipes breaking when /reload

south grove
#

also, is there an easy way to edit loot tables from other mods, instead of datapack style?

quasi pebble
#

loot events or lootjs

fluid mauveBOT
#

LootJS is an addon for KubeJS that allows modifying loot from all sources dynamically (much nicer than loot tables)!
It also supports removing loot added by mods, unlike KubeJS' current loot table events.

south grove
#

how would i remove something from a loot table though?

quasi pebble
#

read the wiki

#

especially that first line

south grove
#

does it go in server scripts though>

quasi pebble
#

the wiki probably tells you that

#

theres even a search bar

south grove
#

I want to replace a recipe, but instead its adding one. How can i replace it?

    //Backpacked
    event.shaped(
        Item.of('backpacked:backpack', 1), // arg 1: output
        [ 
          'HHH', 
          'SIS',
          'HHH'  
        ],
        {
          H: '#modpack:backpacked-craftables', 
          S: '#forge:string',
          I: 'quark:backpack',
        }
      )
#

i found on the wiki:

#

but this is for replacing sticks for all, which isnt what i want

quasi pebble
#

find the recipe id of the original recipe

#

??recipeid

fluid mauveBOT
# quasi pebble ??recipeid

To find a recipes id turn on advanced tooltips (F3 + H) then hover over the recipe output in JEI, or the plus symbol in REI.
You can then use this to specifically remove that recipe: event.remove({id: 'your:id/here'})

quasi pebble
#

then add .id('that:id_goes/here') after the recipes closing ) bracket

south grove
#

it doesnt show where to specify the recipe id

#

lemme try real quick

#

@fluid mauve @quasi pebble

      event.replaceInput.id('backpacked:backpack')
        { input: 'minecraft:iron_ingot' }, // Arg 1: the filter
        'minecraft:iron_ingot', //arg 2: the item to replace
        Ingredient.of('quark:backpack') //arg 3: the item to replace it with
        // Note: tagged fluid ingredients do not work on Fabric, but tagged items do.
    )

vs code says somethign is incorrect though

fluid mauveBOT
quasi pebble
#

🤦‍♂️

#

thats not a recipe

quasi pebble
#

put it after that

south grove
#

right, what I am saying is, from this example:

event.replaceInput(
    { input: 'minecraft:stick' }, // Arg 1: the filter
    'minecraft:stick', //arg 2: the item to replace
    Ingredient.of('#minecraft:saplings') //arg 3: the item to replace it with
    // Note: tagged fluid ingredients do not work on Fabric, but tagged items do.
)

is it not possible to specify for which recipe you want sticks to be replaced?

quasi pebble
#

yes it is, using the id in the filter

#

{id: 'recipe:id/here'}

south grove
#

I still dont understand the format.

Is there not a way to specify it inside this?

    event.replaceInput(
    { input: 'minecraft:iron_ingot }, // Arg 1: the filter
    'minecraft:iron_ingot', //arg 2: the item to replace
    Ingredient.of('quark:backpack') //arg 3: the item to replace it with
    // Note: tagged fluid ingredients do not work on Fabric, but tagged items do.
)
#

where the iron ingot in a specific recipe will be replaced by a quark:backpack

quasi pebble
#

one of the pieces of that is the filter

#

it filters what recipes it can affect

#

you can replace that filter with the one i gave you to only target a specific recipe id

south grove
#

so

    event.replaceInput(
    {id: 'backpacked:backpack'}, // Arg 1: the filter
    'minecraft:iron_ingot', //arg 2: the item to replace
    Ingredient.of('quark:backpack') //arg 3: the item to replace it with
    // Note: tagged fluid ingredients do not work on Fabric, but tagged items do.
)

?

quasi pebble
#

is backpacked:backpack the recipe id? (which is different from the item id)

quasi pebble
#

then yes

south grove
#

also, can i make it change the strings for a tag too at the same time in the same block?

quasi pebble
#

no