KubeJS

KubeJS

69M Downloads

replaceIngredients doesn't work server side only

jjjuk opened this issue · 7 comments

commented

Minecraft Version

1.18.2

KubeJS Version

1802.5.4-build.506

Rhino Version

1802.1.14-build.190

Architectury Version

4.5.75

Forge/Fabric Version

0.14.8

Describe your issue

Hello everyone! The following code adds recipes, but doesn't replaces minecarts with regular ones.

onEvent('recipes', (e) => {
  e.shapeless('minecraft:hopper', [
    'minecraft:hopper_minecart',
  ]).replaceIngredient(0, 'minecraft:minecart')

  e.shapeless('minecraft:chest', [
    'minecraft:chest_minecart',
  ]).replaceIngredient(0, 'minecraft:minecart')

  e.shapeless('minecraft:tnt', [
    'minecraft:tnt_minecart',
  ]).replaceIngredient(0, 'minecraft:minecart')

  console.info(`[TWEAKED] Added minecart recipes`)
})

Is this a bug or a limitation of server-only or is there a way to overcome this problem?

Will play for now without replacement)
Regards.

Crash report/logs

No response

commented

Replace ingredient and co rely on a couple of custom recipe types, so I think this is just a limitation of server only mode.
You should still be able to use the item.crafted event, however that can be wierd when doing multiple crafts.

commented

Yep, ingredient actions rely on us being able to add a custom recipe type for the time being, so they aren't available in server only mode I'm afraid... Sorry about that!

commented

KubeJS does use the default Minecraft recipe types when in server only mode.
These types do not support things like replaceInredients and so those cannot work while in server only mode.

commented

Thank you for your reply! Is it hard to fix kubejs to use default recipe serializer with server only mode? I think it must be possible

commented

KubeJS does use the default Minecraft recipe types when in server only mode. These types do not support things like replaceInredients and so those cannot work while in server only mode.

I mean the same way as buckets and bottles work, are they kind of special?

commented

Thank you very much!

commented

Yes, those are special.
Those use container items (the water, lava and milk buckets container items are all a bucket), and an item can only have one container item.
Any recipe you use a water bucket in will return its container item (a bucket) after crafting.

It is not possible to change container items using KubeJS, and likely wouldn't be possible server side only, if KubeJS did add support for that.