#modifyResult works on localhost but doesn't work on server

14 messages · Page 1 of 1 (latest)

vagrant thistle
#

I added some fluid recipes with the help of modifyResult, to be able to do crafts like "fuel tank with 123 lava + lava bucket = fuel tank with 223 lava". Everything works well on localhost creative test world, but on server only the "fake recipe" is activated, and every craft is replaces with item with exactly 100 units of fluid.

Any help?

const BUCKET_DELTA = 100;

ServerEvents.recipes((event) => {
  if (global.isNormalMode == false) {
    return;
  }

  const bucketFilledRecipes = [
    {
      itemId: "create_sa:small_fueling_tank",
      bucketId: "minecraft:lava_bucket",
      fluidTag: "tagStock",
      fluidCapacity: 800,
    }
    // ...
  ];

  bucketFilledRecipes.forEach((recipe) => {
    const previewNbt = {};
    previewNbt[recipe.fluidTag] = BUCKET_DELTA;
    event
      .shaped(Item.of(recipe.itemId, previewNbt).weakNBT(), [" B ", " I "], {
        I: recipe.itemId,
        B: recipe.bucketId,
      })
      .modifyResult((grid, result) => {
        const vessel = grid.find(recipe.itemId);
        const newNbt = {};
        newNbt[recipe.fluidTag] = Math.min(
          recipe.fluidCapacity,
          BUCKET_DELTA + (vessel.nbt[recipe.fluidTag] || 0)
        );
        return result.withNBT(Object.assign({}, vessel.nbt, newNbt));
      })
      .id(
        [
          "hypercube:fill_",
          recipe.itemId.split(":")[1],
          "_with_",
          recipe.bucketId.split(":")[1],
        ].join("")
      );
  });
});
snow caveBOT
#

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

obtuse hemlock
#

do you use server only mode?

vagrant thistle
#

hmmm, probably

obtuse hemlock
#

??serveronly

mental graniteBOT
# obtuse hemlock ??serveronly

You can run KubeJS server-side only, but with some limitations. You can only run server scripts, for instance.
To enable this, go to \kubejs\config\common.properties and set serverOnly to true.

obtuse hemlock
#

do you have this enabled?

#

if yes, than you can't use any of the special kubejs functions

vagrant thistle
#

Yes, I have serverOnly = true, I'll try to disable this and check again, because I added it in client mods as well.

obtuse hemlock
#

tho if you want vanilla clients to join, then it has to be enabled

#

otherwise, you can disable it

vagrant thistle
#

Makes sense, but it's heavily modded server anyway

#

Reloading config and server_scripts made those recipes go away completely.
Not sure if full server restart is needed, but I can't really do it right now, so I will check this later.

vagrant thistle
#

Thanks, full server restart got it working!