#unification

21 messages · Page 1 of 1 (latest)

near tartan
#

Hi, this is a simple code template that unifies all the things you want :

const objs = [
    { t: 'forge:blocks/electrum',i: 'createaddition:electrum_block' },
    { t: "forge:dusts/diamond",  i: "createaddition:diamond_grit" },
    { t: /*tag to remove*/,      i: /*to this item*/ },
]

//This will remove the tags from the items that are above
ServerEvents.tags('item', event => {
    objs.forEach(obj => {
        event.remove(obj.t, obj.i)
    });
})

//This will remove all the recipes that have items above as input or output.
ServerEvents.recipes(e => {
    objs.forEach((obj) => {
        e.remove({ output: obj.i });
        e.remove({ input: obj.i });
    });
})

if you have any question, ask me😁

vague ether
#

Why using t and i for keys instead of tag and item?

near tartan
#

because it's short

#

like e unstead of event

vague ether
#

We have IDEs to autocomplete that, so if you type "t", with sufficient typing, IDE should suggest "tag"

#

With that, you can also more easily keep track of what is what, except in very common cases - like it's by convention that i and j are for index loops, x, y and z are for coordinates

#

But others? Not so much, you have to look at surrounding context to learn what e, t or i is

#

While event, tag and item are more self-explainatory

#

Better version, provided that a ProbeJS dump is ran:

/**
 * @typedef UnificationObject
 * @prop {Special.ItemTag} tag
 * @prop {Special.Item} item
 */

/** @type {UnificationObject[]} */
const objs = [
  { tag: "forge:storage_blocks/iron", item: "minecraft:iron_block" },
  { tag: "forge:ingots/iron", item: "minecraft:iron_ingot" },
];

//This will remove the tags from the items that are above
ServerEvents.tags("item", (event) => {
  objs.forEach((obj) => {
    event.remove(obj.tag, obj.item);
  });
});

//This will remove all the recipes that have items above as input or output.
ServerEvents.recipes((event) => {
  objs.forEach((obj) => {
    event.remove({ output: obj.item });
    event.remove({ input: obj.item });
  });
});
near tartan
#

Nice, but i don’t know why, but probeJS doesn’t work as well for me

mental trail
#

could this work with fluids too? or be tweaked to work with fluids?

near tartan
#

yes maybe

#

you could try

#

maybe this "item" need to be modified but it's in kubeJS doc

mental trail
muted jewelBOT
#

[➤](#1397773775071875222 message)

ServerEvents.tags('fluid', event => {
    event.removeAllTagsFrom('nuclearcraft:aluminum')
    event.removeAll('forge:molten_aluminum')
    event.add('embers:molten_aluminum', 'forge:molten_aluminum')
    event.add('forge:molten_aluminum', 'embers:molten_aluminum')
    
})```
sacred lynx
#

which kube folder do i place this script in?

sacred lynx
#

aight im just blind lmao