Tinkers Construct

Tinkers Construct

163M Downloads

Modifier display in JEI is tied to recipes, unlike everything else in there

ChiefArug opened this issue ยท 1 comments

commented

Minecraft Version

1.19.2 (doesn't seem to be a 1.19.2 enhancement issue type, but this could be applied to 1.18.2 as well)

Forge Version

43.3.2

Mantle Version

1.10.24

Tinkers' Construct Version

3.8.1.16

Problem description

If you remove the recipe for crafting a modifier, the modifier disappears from JEI. This is inconsistent because it is not how items and fluids in JEI work.

Suggested solution

Make if a modifier shows in JEI a property of the modifier, rather than tied to if a recipe for it exists (IE an internal property, for modifiers that are only traits). This doesn't entirely solve the situation for unused modifiers though.

Alternatives considered

Using a hacky KubeJS script like this:

let modifiersLoaded = false
const $TinkersJEI = Java.loadClass('slimeknights.tconstruct.plugin.jei.TConstructJEIConstants')
const $ModifierManager = Java.loadClass('slimeknights.tconstruct.library.modifiers.ModifierManager')
const $ModifierEntry = Java.loadClass('slimeknights.tconstruct.library.modifiers.ModifierEntry')

function getAllModifiersForJEI() {
    return $ModifierManager.INSTANCE.getAllValues().map(m => new $ModifierEntry(m, 1)).toList()
}
global.modifierLoadEvent.push(() => { // where global.modifierLoadEvent is a list of listeners for `slimeknights.tconstruct.library.modifiers.ModifierManager$ModifiersLoadedEvent`
    if (global.jeiRuntime == undefined) 
        modifiersLoaded = true
    else if (Client.isSameThread()) 
            global.jeiRuntime.getIngredientManager().addIngredientsAtRuntime($TinkersJEI.MODIFIER_TYPE, getAllModifiersForJEI())
})
JEIEvents.hideCustom(event => {
    if (modifiersLoaded) 
        global.jeiRuntime.getIngredientManager().addIngredientsAtRuntime($TinkersJEI.MODIFIER_TYPE, getAllModifiersForJEI())
})

Have a config option determining which modifiers show in JEI (this could also be included with the original idea, a 'show internal modifiers in jei' option.)

Additional context

This is related to #5223 for people who are trying to make some modifiers only obtainable via crystals so are removing the normal recipe. If that is fixed through adding an alternative 'crystal only' recipe type this could also be considered fixed as that would be a way to show the modifier in JEI without having to have a 'proper' way to obtain it. (given the crystal recipes require a very specific item that is not obtainable without having access to the modifier, and crystal recipes dont show up in the recipe list)

Searched for existing enhancement?

Used the search bar, Checked the FAQ

commented

There is no reason to show a modifier if its not craftable. They will lack a modifier icon, and you have no way to apply it to tools. You also end up seeing internal modifiers that way.

JEI does not show all items, it is filtered.