#How could I make this code more efficient?
18 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
Paste version of message.txt from @coarse flame
for loops
how to do that 🤔
wait lemme read the documentation on this one...
Huh, so loops in this are kinda similar to functions in Python? I'm learning that rn and this kinda reminds me of that
A for loop is a programming construct that executes a block of code repeatedly until a condition is met. They are used to iterate over a sequence, such as a list, array, or collection, and perform a certain action a set number of times.
ty for pointing me in the right direction
hm, this doesn't seem to be working
ServerEvents.recipes(event => {
let oreCrushing = (output, crushedInput) => {
event.recipes.create.crushing([Item.of('create:experience_nugget').withChance(0.75), Item.of(output * 3)], crushedInput)
}
oreCrushing('create:crushed_raw_copper', '#forge:ores/copper')
})```
it seems like it doesn't like it when I try to make multiple outputs in the helper function
you're trying to multiply a string by tree, not setting the output to tree
It should be something like this iirc
Item.of(output, 3)
figured this out, tysm !
Please close your ticket (with </ticket close:1054771505520717835> or the button atop this thread) once you resolved your issue! This also helps others that would like to help out, as they don't have to look into this thread to check if it has been resolved by now.
Do you have any other questions regarding your issue? Feel free to ask!
Note: You should generally create a new post for unrelated issues.