#mystical agriculture recipe remove/custom not working as expected

157 messages · Page 1 of 1 (latest)

ember bane
#

I'm trying to remove and then create custom recipes for mystical agriculture infusions.
I'm using this function

const infusion = (e, seed, seedId, input, combType, essenceType) => {
      e.remove({id: seedId})
      const comb = Ingredient.of('productivebees:spawn_egg_configurable_bee', {
        EntityTag: {
          type: `productivebees:${combType}`
        }
      })
      const essence = Ingredient.of(essenceType)
      e.custom({
        type: 'mysticalagriculture:infusion',
        input: Ingredient.of(input),
        ingredients: [
          essence, 
          comb,
          essence, 
          comb,
          essence, 
          comb,
          essence, 
          comb,
        ],
        result: Ingredient.of(seed)
      }).id(seedId)
    }

but the relevant error is:

[15:19:58] [ERR  ] Error occurred while handling event 'recipes': Cannot convert [object Object] to java.lang.Integer (server_scripts:recipes/mystical_agriculture.js#513)

and I've attached the kubejs/server.txt

winter wagonBOT
#

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

runic ravenBOT
#

Paste version of server.txt from @ember bane

ember bane
#

uh... ok I'm 10x verifying now cuz it's randomly working... swear I've tried like 10 different ways to do this (trying to avoid mystical customizations and explicit json usage)

#

^ not totally random, I changed the comb to be Item.of() instead

ember bane
#

aight, so it sort of worked... it didn't add the NBT tag to the honeycomb as I would have expected

marble heron
# ember bane aight, so it sort of worked... it didn't add the NBT tag to the honeycomb as I w...

Try This

const infusion = (e, seed, seedId, input, combType, essenceType) => {
e.remove({ id: seedId });
const comb = Ingredient.of('productivebees:spawn_egg_configurable_bee', {
EntityTag: {
type: productivebees:${combType}
}
});
const essence = Ingredient.of(essenceType);
e.custom({
type: 'mysticalagriculture:infusion',
input: Ingredient.of(input),
ingredients: [
essence,
comb,
essence,
comb,
essence,
comb,
essence,
comb,
],
result: seed.id(seedId)
});
};

ember bane
#

I got

[1] Error occurred while handling event 'recipes': TypeError: Cannot call property id in object 'mysticalagriculture:glowstone_seeds'. It is not a function, it is "object". (server_scripts:recipes/mystical_agriculture.js#516)
#

lemme change the function real quick, the most working state I've gotten it into is this:

const infusion = (e, seed, seedId, input, combType, essenceType) => {
      e.remove({id: seedId})
      const comb = Item.of('productivebees:configurable_honeycomb', {
          EntityTag: {
              type: `productivebees:${combType}`
          }
      })
      const essence = Ingredient.of(essenceType)
      e.custom({
        type: 'mysticalagriculture:infusion',
        input: Ingredient.of(input),
        ingredients: [
          essence, 
          comb,
          essence, 
          comb,
          essence, 
          comb,
          essence, 
          comb,
        ],
        result: Ingredient.of(seed)
      }).id(seedId)
    }
marble heron
#

do you have a copy of the whole file? it seems its conflicting with something

ember bane
runic ravenBOT
#

Paste version of mystical_agriculture.js from @ember bane

ember bane
#

there's some other stuff up top that shouldn't be relevant

#

with that file, it works... except the honeycombs don't have the NBT tags that differentiate the types

#

(oh... actually this file on line 511 was testing if I needed the "EntityTag" part, so it's omitted. Still had the same result tho)

marble heron
#

what mod do the combs come from?

ember bane
#

productivebees

marble heron
#

this might work

// Assuming infusion is a valid function and e is the event object

const getCombNBT = (combType) => ({
type: productivebees:${combType}
});

const infusion = (e, seed, seedId, input, combType, essenceType) => {
e.remove({ id: seedId });

// Generate NBT data for the configurable_honeycomb based on combType
const comb = Item.of('productivebees:configurable_honeycomb').data(getCombNBT(combType));

const essence = Ingredient.of(essenceType);

e.custom({
    type: 'mysticalagriculture:infusion',
    input: Ingredient.of(input),
    ingredients: [
        essence,
        comb,
        essence,
        comb,
        essence,
        comb,
        essence,
        comb,
    ],
    result: Ingredient.of(seed)
}).id(seedId);

};

// Example usage
infusion(event, 'output_seed', 'output_seed_id', 'input_item', 'desired_comb_type', 'essence_type');

#

it takes into account the NBT data and makes the specified recipe depending on the comb

ember bane
#

it doesn't like the .data() function
I keep getting ```
[1] Error occurred while handling event 'recipes': TypeError: Cannot find function data in object 'productivebees:configurable_honeycomb'. (server_scripts:recipes/mystical_agriculture.js#539)

marble heron
#

const getCombNBT = (combType) => ({
type: productivebees:${combType}
});

const infusion = (e, seed, seedId, input, combType, essenceType) => {
e.remove({ id: seedId });

// Generate NBT data for the configurable_honeycomb based on combType
const comb = Item.of('productivebees:configurable_honeycomb', getCombNBT(combType));

const essence = Ingredient.of(essenceType);

e.custom({
    type: 'mysticalagriculture:infusion',
    input: Ingredient.of(input),
    ingredients: [
        essence,
        comb,
        essence,
        comb,
        essence,
        comb,
        essence,
        comb,
    ],
    result: Ingredient.of(seed)
}).id(seedId);

};

// Example usage
infusion(event, 'output_seed', 'output_seed_id', 'input_item', 'desired_comb_type', 'essence_type');

Fixed it i hope lol

ember bane
#

I just tried that as well, no luck...

#

well

#

I say that, it's back to a prior issue

#

no syntax errors, but the combs are all without nbt's

marble heron
#

1.20.1 is messed up at the moment so I'm not really surprised tbh

ember bane
#

oh, I'm on 1.18.2

marble heron
#

oh?

#

ah thats my mistake lol 1 sec

ember bane
#

🙂 all good

marble heron
#

here you go lol

const getCombNBT = (combType) => ({
type: productivebees:${combType}
});

const infusion = (e, seed, seedId, input, combType, essenceType) => {
e.remove({ id: seedId });

// Generate NBT data for the configurable_honeycomb based on combType
const comb = Item.of('productivebees:configurable_honeycomb').nbt(getCombNBT(combType));

const essence = Ingredient.of(essenceType);

e.custom({
    type: 'mysticalagriculture:infusion',
    input: Ingredient.of(input),
    ingredients: [
        essence,
        comb,
        essence,
        comb,
        essence,
        comb,
        essence,
        comb,
    ],
    result: Ingredient.of(seed)
}).id(seedId);

};

// Example usage
infusion(event, 'output_seed', 'output_seed_id', 'input_item', 'desired_comb_type', 'essence_type');

#

my brain is all over the place today, 1.20.1 doesn't even work for changing recipes yet so thats why i thought 1.20.1 lol

#

im praying it works though

ember bane
#

all good haha, so far I've got

Cannot call property nbt in object 'productivebees:configurable_honeycomb'. It is not a function, it is "object".
marble heron
#

you're crafting seeds with this right?

ember bane
#

yep

#

changing their recipes

#

where it would be glowstone dust, I'm making it glowstone combs

marble heron
#

i did that at one point, but i did them all individually when i did it

ember bane
#

mmmmm, yeeeaaaaaaa I really wanted to avoid individualllls

marble heron
runic ravenBOT
#

Paste version of Mystical.js from @marble heron

marble heron
#

thats a bit of what i was doing, I don't recomend it though lol

#

but its confusing the hell outa me with yours though

#

what version of kube you running?

ember bane
#

kubejs-forge-1802.5.5-build.569.jar

#

fr fr, even the more-recipe-types github repo I found isn't working for mystical agriculture specifically

marble heron
#

have you looked at the new syntax for it yet?

#

try this btw

const getCombNBT = (combType) => ({
type: productivebees:${combType}
});

const infusion = (e, seed, seedId, input, combType, essenceType) => {
e.remove({ id: seedId });

// Generate NBT data for the configurable_honeycomb based on combType
const combNBT = getCombNBT(combType);
const combItem = Item.of('productivebees:configurable_honeycomb');

// Set NBT data for the item
Object.keys(combNBT).forEach(key => combItem.set(key, combNBT[key]));

const essence = Ingredient.of(essenceType);

e.custom({
    type: 'mysticalagriculture:infusion',
    input: Ingredient.of(input),
    ingredients: [
        essence,
        combItem,
        essence,
        combItem,
        essence,
        combItem,
        essence,
        combItem,
    ],
    result: Ingredient.of(seed)
}).id(seedId);

};

// Example usage
infusion(event, 'output_seed', 'output_seed_id', 'input_item', 'desired_comb_type', 'essence_type');

ember bane
#

oh interesting... I didn't see this syntax

marble heron
#

you know with 1.18 you use "onEvent" right?

#

They changed it to this "onEvent('event', e => {}) syntax was replaced by SomeEventGroup.someEventName(e => {})"

ember bane
#

I thought that change was for 1.19+????

marble heron
#

yeah it has, so good luck if u wanna upgrade your version

#

im trying to use 1.20.1 and it's breaking everything

#

the new syntax sucks

ember bane
#

rip... I was considering upgrading the version to at least 1.19, but I think it's iceandfire that's only out for 1.18 so far (except for older versions), so I'm locked at 1.18 :/

marble heron
#

its not worth it right now, it'll break everything you already have with "onEvent"

ember bane
#

Cannot find function set in object 'productivebees:configurable_honeycomb'

marble heron
#

productivebees:configurable_honeycomb this is a tag right?

ember bane
#

that's the id

#

the tag structure is { EntityTag: { type: productivebees:${combType}}}

#

^I've been trying your code with both EntityTag and not btw

#

this is how mystical agriculture structures the recipe...

{
  "type": "mysticalagriculture:infusion",
  "conditions": [
    {
      "type": "mysticalagriculture:crop_enabled",
      "crop": "mysticalagriculture:glowstone"
    },
    {
      "type": "mysticalagriculture:crop_has_material",
      "crop": "mysticalagriculture:glowstone"
    }
  ],
  "input": {
    "type": "mysticalagriculture:crop_component",
    "component": "seed",
    "crop": "mysticalagriculture:glowstone"
  },
  "ingredients": [
    {
      "type": "mysticalagriculture:crop_component",
      "component": "material",
      "crop": "mysticalagriculture:glowstone"
    },
    {
      "type": "mysticalagriculture:crop_component",
      "component": "essence",
      "crop": "mysticalagriculture:glowstone"
    },
    {
      "type": "mysticalagriculture:crop_component",
      "component": "material",
      "crop": "mysticalagriculture:glowstone"
    },
    {
      "type": "mysticalagriculture:crop_component",
      "component": "essence",
      "crop": "mysticalagriculture:glowstone"
    },
    {
      "type": "mysticalagriculture:crop_component",
      "component": "material",
      "crop": "mysticalagriculture:glowstone"
    },
    {
      "type": "mysticalagriculture:crop_component",
      "component": "essence",
      "crop": "mysticalagriculture:glowstone"
    },
    {
      "type": "mysticalagriculture:crop_component",
      "component": "material",
      "crop": "mysticalagriculture:glowstone"
    },
    {
      "type": "mysticalagriculture:crop_component",
      "component": "essence",
      "crop": "mysticalagriculture:glowstone"
    }
  ],
  "result": {
    "item": "mysticalagriculture:glowstone_seeds"
  }
}
#

would config/mysticalcustomizations be the only way then to change the "material" of the crop?

marble heron
#

like to change what the crop drops?

ember bane
#

or I guess a datapack json with {item: "productivebees:configurable_honeycomb", nbt: { EntityTag: { type: "productivebees:glowstone"}}} in place of the ones that use component: "material"

#

in the recipe under ingredients it has some with "component":"material"

marble heron
#

well you could just change the material to any material in the game, as long as you can identify it

ember bane
#

right... is this how I would specify an nbt tag in a json?

{
  item: "productivebees:configurable_honeycomb", 
  nbt: { EntityTag: { type: "productivebees:glowing"}}
}
#

might try this next

marble heron
#

i mean technically yes that'd work but you'd probably have to do this instead
{
item: "productivebees:configurable_honeycomb",
nbt: { EntityTag: { type: "productivebees:honeycomb_glowstone"}}
}

#

this might also work now but i give no garuntees const getCombNBT = (combType) => ({
type: productivebees:${combType}
});

const infusion = (e, seed, seedId, input, combTag, essenceType) => {
e.remove({ id: seedId });

// Generate NBT data for the configurable_honeycomb based on combType
const combNBT = getCombNBT(combType);

// Create a new ItemStack with NBT data
const combItem = e.createItem(Ingredient.of(combTag).toJson());
combItem.nbt(combNBT);

const essence = Ingredient.of(essenceType);

e.custom({
    type: 'mysticalagriculture:infusion',
    input: Ingredient.of(input),
    ingredients: [
        essence,
        combItem,
        essence,
        combItem,
        essence,
        combItem,
        essence,
        combItem,
    ],
    result: Ingredient.of(seed)
}).id(seedId);

};

// Example usage
infusion(event, 'output_seed', 'output_seed_id', 'input_item', 'productivebees:configurable_honeycomb', 'essence_type');

ember bane
#

mm, the advanced tooltips say "productivebees:glowing"

marble heron
#

ohh

#

lemme check something rq

ember bane
#

btw, in your getCombNBT() should I make {EntityTag:{type: "blahblah"}} or {type:"blahblah"}?

#

the EntityTag one shows up in advanced tooltips

marble heron
#

does it give it a forge tag at all?

ember bane
#

forge:honeycombs

#

and itemfilters:check_nbt

#

but those are just the normal tags... the ones that have different colored highlights are just the EntityTag

marble heron
ember bane
#

://///

#

is there a difference between ntbTags and nbtData?

marble heron
#

nbt tags are for more than one of the same item, NBT data is for individual items

ember bane
#

gotcha... is there a chance that we're setting tags (that aren't actually defined yet hence it not working) when we should be setting data?

#

aside from that that thought... as;lhfdewgkjpgahjda brain so fry

marble heron
#

currently i should be trying to check each comb before crafting to see if the nbt matches for the crafting recipe

#

it*

ember bane
#

right, issue is the recipe itself is calling for the generic comb with no nbt data

marble heron
#

what comb do you want it to be?

#

or do you want it to check tags?

#

okay actually, what are you trying to get the recipe to make?

ember bane
#

I've got the whole list in the file, but one example is the glowstone seeds from mystical agriculture. Original recipe is essence (I forget the tier) and glowstone dust. I want to change the dust to be glowing honeycomb (id: productivebees:configurable_honeycomb, nbt data {EntityTag: {type:productivebees:glowing}}). Output should still be mysticalagriculture glowstone seeds

marble heron
#

ohh

#

there's a simpler way to do it but i get why you don't wanna do it individually lol

#

you want that done for all seeds right?

ember bane
#

: o simpler?

#

all seeds that also have combs which output the same thing

#

some resources the combs get that the seeds dont, and vice versa

#

the list in the file should be all of the seeds/combs that match

marble heron
#

alright lemme take a better look rq

marble heron
#

Question for you

#

Have you ever made a custom tag before?

ember bane
#

not really... sort of. I don't understand it tho

runic ravenBOT
#

Paste version of mystical_agriculture.js from @ember bane

ember bane
#

I can make a tag and add each comb to it?

#

btw I def copied that from atm7 (or 6? whichever was 1.18.2)

marble heron
#

lmao, yeah you can make a custom tag for the combs

#

const getCombNBT = (combType) => ({
type: productivebees:${combType}
});

const infusion = (e, seed, seedId, input, combType, essenceType) => {
e.remove({id: seedId});

// Generate NBT data for the configurable_honeycomb based on combType
const combNBT = getCombNBT(combType);

// Create an Ingredient representing the configurable_honeycomb with NBT data
const combItem = Item.of('productivebees:configurable_honeycomb').nbt(combNBT);

const essence = Ingredient.of(essenceType);

e.custom({
    type: 'mysticalagriculture:infusion',
    input: Ingredient.of(input),
    ingredients: [
        essence,
        combItem,
        essence,
        combItem,
        essence,
        combItem,
        essence,
        combItem,
    ],
    result: Ingredient.of(seed)
}).id(seedId);

};

// Example usage
infusion(event, 'output_seed', 'output_seed_id', 'input_item', 'desired_comb_type', 'essence_type');

Try this

ember bane
#

we've tried that one before right?

#

I'll try again

marble heron
#

hang on i just noticed something

#

const getCombNBT = (combType) => ({
type: productivebees:${combType}
});

const infusion = (e, seed, seedId, input, combType, essenceType) => {
e.remove({id: seedId});

// Generate NBT data for the configurable_honeycomb based on combType
const combNBT = getCombNBT(combType);

// Create an Ingredient representing the configurable_honeycomb with NBT data
const combItem = Item.of('productivebees:configurable_honeycomb').nbt(combNBT);

const essence = Ingredient.of(essenceType);

e.custom({
    type: 'mysticalagriculture:infusion',
    input: Ingredient.of(input),
    ingredients: [
        essence,
        combItem,
        essence,
        combItem,
        essence,
        combItem,
        essence,
        combItem,
    ],
    result: Item.of(seed)  // Corrected this line to use Item.of for the result
}).id(seedId);

};

// Example usage
infusion(event, 'output_seed', 'output_seed_id', 'input_item', 'desired_comb_type', 'essence_type');

#

if that doesn't work i'll do some testing on my end too

ember bane
#

word, and really quick.. the getCombNBT(). that's supposed to be {EntityTag: {type: "blah"}} right?

marble heron
#

try leaving it the way it is

#

see what it says

ember bane
#

aight

#

with your exact code I get ```
TypeError: Cannot call property nbt in object 'productivebees:configurable_honeycomb'. It is not a function, it is "object". (server_scripts:recipes/mystical_agriculture.js#519)

#

vv this should be enough to test with if you're making a testing profile.
this also assumes you start with onEvent('recipes', e => {})

const beeify = [
    {
        beeType: 'glowing',
        seedType: 'glowstone',
        middle: 'mysticalagriculture:prosperity_seed_base',
        essence: 'mysticalagriculture:tertium_essence'
    }
]

const infusion = (e, seed, seedId, input, combType, essenceType) => {
      e.remove({id: seedId})
      const combTag = {
        EntityTag: {
          type: combType
        }
      }
      const comb = Item.of('productivebees:configurable_honeycomb', 1, combTag)
      const essence = Ingredient.of(essenceType)
      e.custom({
        type: 'mysticalagriculture:infusion',
        input: Ingredient.of(input),
        ingredients: [
          essence, 
          comb,
          essence, 
          comb,
          essence, 
          comb,
          essence, 
          comb,
        ],
        result: Item.of(seed)
      }).id(seedId)
    }

    beeify.forEach(item => {
      infusion(e,
        `mysticalagriculture:${item.seedType}_seeds`,
        `mysticalagriculture:seed/infusion/${item.seedType}`,
        item.middle,
        `productivebees:${item.beeType}`,
        item.essence
      )
    })
marble heron
#

this should fix that error you got

const getCombNBT = (combType) => ({
type: productivebees:${combType}
});

const infusion = (e, seed, seedId, input, combType, essenceType) => {
e.remove({ id: seedId });

// Generate NBT data for the configurable_honeycomb based on combType
const combNBT = getCombNBT(combType);

// Create an Ingredient representing the configurable_honeycomb with NBT data
const combItem = Item.of('productivebees:configurable_honeycomb').nbt(combNBT).toJson();  // Add .toJson() here

const essence = Ingredient.of(essenceType);

e.custom({
    type: 'mysticalagriculture:infusion',
    input: Ingredient.of(input),
    ingredients: [
        essence,
        combItem,
        essence,
        combItem,
        essence,
        combItem,
        essence,
        combItem,
    ],
    result: Item.of(seed).toResultJson()  // Corrected this line to use toResultJson
}).id(seedId);

};

// Example usage
infusion(event, 'output_seed', 'output_seed_id', 'input_item', 'desired_comb_type', 'essence_type');

#

🤞

ember bane
#

🤞

#

it still doesn't like .nbt()
I'll try with the nbtTag inside the Item.of().toJson()

marble heron
#

i was abt to say that lol

#

just paste this lol

const getCombNBT = (combType) => ({
type: productivebees:${combType}
});

const infusion = (e, seed, seedId, input, combType, essenceType) => {
e.remove({ id: seedId });

// Generate NBT data for the configurable_honeycomb based on combType
const combNBT = getCombNBT(combType);

// Create an Ingredient representing the configurable_honeycomb with NBT data
const combItem = Ingredient.of('productivebees:configurable_honeycomb').toJson();
combItem.nbt(combNBT);

const essence = Ingredient.of(essenceType);

e.custom({
    type: 'mysticalagriculture:infusion',
    input: Ingredient.of(input),
    ingredients: [
        essence,
        combItem,
        essence,
        combItem,
        essence,
        combItem,
        essence,
        combItem,
    ],
    result: Item.of(seed)  // Corrected this line to use Item.of for the result
}).id(seedId);

};

// Example usage
infusion(event, 'output_seed', 'output_seed_id', 'input_item', 'desired_comb_type', 'essence_type');

marble heron
#

Item.of doesn't work with trying to get nbt data

#

because it was trying to use all of the combs to get a specified item to use

ember bane
#

it looked like it did when the probe.js tooltip came up... had an overload for Item.of(in_: Internal.ItemStackJS_, tag: Internal.CompoundTag_): Internal.ItemStackJS (+3 overloads)

marble heron
#

weird

#

i've only gotten an error like that twice lol

#

still don't know what caused it lol

ember bane
#

HOLY POOP IT WORKED

#
const infusion = (e, seed, seedId, input, combType, essenceType) => {
      e.remove({id: seedId})
      const combTag = {
        EntityTag: {
          type: combType
        }
      }
      const comb = Item.of('productivebees:configurable_honeycomb', combTag).toJson()
      const essence = Ingredient.of(essenceType)
      e.custom({
        type: 'mysticalagriculture:infusion',
        input: Ingredient.of(input),
        ingredients: [
          essence, 
          comb,
          essence, 
          comb,
          essence, 
          comb,
          essence, 
          comb,
        ],
        result: Item.of(seed).toResultJson()
      }).id(seedId)
    }

    beeify.forEach(item => {
      infusion(e,
        `mysticalagriculture:${item.seedType}_seeds`,
        `mysticalagriculture:seed/infusion/${item.seedType}`,
        item.middle,
        `productivebees:${item.beeType}`,
        item.essence
      )
    })
#

I've been plagued for days...

#

no longer

#

thank you ser ┬─┬ノ( º _ ºノ)

marble heron
#

You're quite welcome haha, I'm glad i could help

#

the main problem is it wasn't adding the comb as an ingredient in the craft

ember bane
#

interesting

#

I haven't had to specify .toJson() or .toResultJson() before

marble heron
#

e.custom({
type: 'mysticalagriculture:infusion',
input: Ingredient.of(input),

Only says "ingredient.of" for input

marble heron
ember bane
#

what even is Ingredient.of().. how is it different from Item.of()?

marble heron
#

The main difference being instead of designating a crafting ingredient, you designated a crafting item, as in theres only 1 and they don't stack

ember bane
#

interesting... so is that basically the same as Item.of('item_id', 1, nbt_stuff)? That also appears to be an overload

marble heron
#

yeah basically

ember bane
#

anyways I'm free from the shackles of mystical agriculture... A great weight has been lifted! I need to decompress by playing overwatch lmao

marble heron
#

lmao, enjoy

#

feel free to dm if u need more help

ember bane
#

haha thanks again, I'll take you up on that 🙂