#Getting an ingredient for any item

17 messages · Page 1 of 1 (latest)

vivid kite
#

How would I get an ingredient that is true for any item?

ItemEvents.modification(e => {
    e.modify(Ingredient.of(), i => i.setMaxStackSize(i.item().getMaxStackSize()*1000))
})```I want to multiply all stack sizes by 1000
obtuse coralBOT
#

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

vivid kite
# granite breach `'*'`
[17:55:04] [ERROR] ! …rhino.EvaluatorException: Can't find method net.neoforged.neoforge.common.extensions.IItemExtension.getMaxStackSize(). (startup_scripts:main.js#2)```
#

I mean, probe suggested it to me

granite breach
#

getDefaultMaxStackSize()

vivid kite
#

How do items with durability ?

#

Do they each have their own durability or share one?

thorn crest
#

isnt there also Ingredient.all

vivid kite
#

Ok, that settles it lul

granite breach
#

probably, but I always use '*'

#

just check if it already didnt have max size 1

vivid kite
#

Yeah

#

But its a shame that this isn't possible

granite breach
#
ItemEvents.modification(e => {
  e.modify(Ingredient.of(), i => {
    let s = i.item().getDefaultMaxStackSize()
    if(s > 1) i.setMaxStackSize(s * 1000))
  }
})
vivid kite
#
ItemEvents.modification(e => {
    e.modify(Ingredient.of("*"), i => {
        let oldMaxStackSize = i.item().getDefaultMaxStackSize()
        if (oldMaxStackSize > 1) {
            i.setMaxStackSize(oldMaxStackSize*1000)
        }
    })
})
```Yeah, I got about the same thing
#

Thanks a lot