KubeJS

KubeJS

69M Downloads

recipes.after_load event never fires.

CKY- opened this issue · 7 comments

commented

Minecraft Version

1.18.2

KubeJS Version

kubejs-forge-1802.5.1-build.353

Rhino Version

rhino-forge-1801.1.9-build.135

Architectury Version

architectury-4.2.50

Forge/Fabric Version

Forge-40.1.0 - 40.1.68

Describe your issue

The onEvent('recipes.after_load', e => { never runs.

[12:44:59] [INFO ] Loaded script server_scripts:constants.js in 0.001 s
[12:44:59] [INFO ] server_scripts:kube_remove.js:6: Hello, From kubejs_remove.js (You will see this line every time this server resource is loaded)
[12:44:59] [INFO ] Loaded script server_scripts:kube_remove.js in 0.0 s
[12:44:59] [INFO ] server_scripts:tags.js:5: Hello, From tags.js (You will see this line every time this server resource is loaded)
[12:44:59] [INFO ] Loaded script server_scripts:tags.js in 0.001 s
[12:44:59] [INFO ] Loaded 3/3 KubeJS server scripts in 0.004 s
[12:44:59] [INFO ] Scripts loaded
[12:44:59] [INFO ] Scanning recipes...
[12:45:01] [INFO ] [fluids] Found 57 tags, added 2 objects, removed 0 objects
[12:45:01] [INFO ] [fluids] Found 57 tags, added 2 objects, removed 0 objects
[12:45:02] [INFO ] [blocks] Found 1266 tags, added 554 objects, removed 32 objects
[12:45:02] [INFO ] [blocks] Found 1266 tags, added 554 objects, removed 32 objects
[12:45:03] [INFO ] server_scripts:tags.js:7: We are in tags.items
[12:45:10] [INFO ] Found 23670 recipes and 0 failed recipes in 507.6 ms
[12:45:11] [INFO ] server_scripts:kube_remove.js:20: we are inside the recipes event
[12:45:11] [INFO ] Posted recipe events in 7.177 ms
[12:45:11] [INFO ] Modified & removed recipes in 382.5 ms
[12:45:11] [INFO ] Added recipes in 32.30 μs
[12:45:11] [INFO ] Added 0 recipes, removed 2 recipes, modified 0 recipes, with 0 failed recipes and 0 fall-backed recipes
settings.logAddedRecipes = false
settings.logRemovedRecipes = true
settings.logSkippedRecipes = false
settings.logErroringRecipes = true

console.info('Hello, From kubejs_remove.js (You will see this line every time this server resource is loaded)')
onEvent('recipes.after_load', e => {
    e.remove({ input: 'immersiveengineering:hammer', output: '#forge:plates' })
    console.info('we are inside the recipes.after_load event')
})

onEvent('recipes', e => {
    var idRemove = [
        'minecraft:comparator',
        'minecraft:glass',
    ];
    idRemove.forEach(iR => {
        e.remove({ id: iR });
    });
    console.info('we are inside the recipes event')
})

Crash report/logs

No response

commented

This seems to still be an issue
(https://discord.com/channels/303440391124942858/917515067027767357/984957103678566460 In the latvian.dev server)

KubeJS 1802.5.4-build.492
Rhino 1802.1.14-build.182
Architectury 4.4.70
Forge 40.1.25

  function padding(s){ // just so it is easier to find my logs
      console.log(s)
      console.log(s)
      console.log(s)
      console.log(s)
      console.log(s)  
  }
  
  
  const nocraft = ['minecraft:diamond_sword','minecraft:iron_sword']
  
  
  onEvent('recipes.after_load', event => { 
      padding("DURING AFTER LOAD EVENT")
  
	  nocraft.forEach(item => {
            console.log(`Removing recipe for item ${item}`)
            event.remove({ output: item })
	  })
  })
commented

This still happens on the versions below

architectury-4.8.80
kubejs-forge-1802.5.4
forge-40.1.60
rhino-forge-1802.1.14-build.209
commented

This still happens on 1.19.2

commented

Weird workaround: tweak the crafting recipe with an unobtainable recipe, like so:

ServerEvents.recipes((event) => {
    event.shapeless('apotheosis:ender_lead', [
        'minecraft:bedrock', 'minecraft:bedrock', 'minecraft:bedrock',
        'minecraft:bedrock', 'minecraft:bedrock', 'minecraft:bedrock',
        'minecraft:bedrock', 'minecraft:bedrock', 'minecraft:bedrock',
    ]).id('apotheosis:ender_lead');
});

Works in 1.19.2 (haven't tried it on 1.18).

commented

Is this still relevant? Here's working code for 1.19.2:

ServerEvents.afterRecipes((event) => {
    event.remove({ id: 'apotheosis:ender_lead' });
});

EDIT: This does not actually work. It still seems broken as of 1.19.
(I wrote this thinking the recipe was removed, but it wasn't. Must've misclicked.)

commented

Weird workaround: tweak the crafting recipe with an unobtainable recipe, like so:

ServerEvents.recipes((event) => {
    event.shapeless('apotheosis:ender_lead', [
        'minecraft:bedrock', 'minecraft:bedrock', 'minecraft:bedrock',
        'minecraft:bedrock', 'minecraft:bedrock', 'minecraft:bedrock',
        'minecraft:bedrock', 'minecraft:bedrock', 'minecraft:bedrock',
    ]).id('apotheosis:ender_lead');
});

Works in 1.19.2 (haven't tried it on 1.18).

some recipes will still be reverted back to the original or can't be modified at all or worse just have the one you want and the original, this is why this event is needed and yes in 1.18-1.19.4 its still an issue.

commented

Event never fires on ATM9 TTS