#Semi-generic tool upgrade script (save the NBT)

32 messages · Page 1 of 1 (latest)

fresh frost
#

Semi-generic tool upgrade script (save the NBT)

earnest rock
#

Might I inquire as to the why original message was deleted?

#

Judging by the title, it could be just the example I've been looking for to handle nbt in crafting recipes. But there's no way to know hmmm

inland shuttle
#

@fresh frost sry for ping, why you delete the original message?

fresh frost
#

wait when did I delete this lol

#

let me check and see if I have a copy of the old script, I don't remember deleting the 1.20.1 version

#
// fluff recipes, might remove later
  
    // transfer nbt from item to #forge:books
    event.shapeless('#forge:tools', ['#forge:tools', '#forge:tools']).modifyResult((grid, result) => {
      let item1 = grid.get(0); // First slot assumed to be a tool
      let item2 = grid.get(1); // Second slot assumed to be another tool
      if (item2.getCount() === 1) { // Check if there is exactly one item in the second slot
        return Item.of(item2, 1).withNBT(item1.nbt); // Ensure only one output item with merged NBT
      }
      return result; // Return original result if condition is not met
    }).id('kubejs:nbt_recipe_tools');
  
    event.shapeless('#forge:armors', ['#forge:armors', '#forge:armors']).modifyResult((grid, result) => {
      let item1 = grid.get(0); // First slot assumed to be tools
      let item2 = grid.get(1); // Second slot assumed to be book
      if (item2.getCount() === 1) { // Check if there is exactly one book
        return Item.of(item2, 1).withNBT(item1.nbt); // Ensure only one output item with copied NBT
      }
      return result; // Return original result if condition is not met
    }).id('kubejs:nbt_recipe_armors')
#

I used these to transfer NBT from one item to another useless a return result form of recipe generation

#

honestly I don't remember deleting this, maybe there was a kubejs update that broke it and I got frustrated and deleted it? or maybe this was a duplicate?

steady oyster
#

So does this just allow you to basically upgrade for example an enchanted iron pick into a diamond pick?

fresh frost
#

yes

#

basically it transfers all the NBT (including damage)

#

which means it also allow free repairs, with anything tagged tool to tool and armor to armor

#

didn't find a way around that

#

I also have a smithing table one that let's you upgrade from wood to stone to iron to diamond

#

that's a LITTLE less cheaty, but it's huge

stuck wraithBOT
#

Paste version of smithing_recipes.js from @fresh frost

fresh frost
#

feel free to look over this old 1.20.1 code, I mainly work on 1.21.1 now so I can't really say what works or doesn't work in this old code

steady oyster
#

Oh nice

#

Pretty cool

#

I've posted a few scripts myself but most are cursed af

fresh frost
#

most of my scripts are very cursed

#

want a free cursed make all food edible script for 1.21?

#

cuz that's the kind of stuff I deal in now, the good stuff sniff

#

in fact I think that's one of my example scripts in examples lol

steady oyster
#

I added any chest compat to TerraFirmaCraft without a mod using reflection

fresh frost
#

nice

steady oyster
#

Thanks

earnest rock
#

I'm sure there's plenty of useful lines of code living in the cursed projects as well