#Modifiying food wont work
53 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
oh damn
is there any way i could get around that
or would i have to go into mod files and change the code
ask the mod author to fix their code or use reflection through kubejs
should not be that hard
you could recreate the item through kubejs and set custom properties
if i cant find any other way i might just take the textures and do that lmao
but ty guys
Ticket closed!
no i mean you dont need to do anything with textures
if youd give me a moment id do it for you here 
oh alr sure
nevermind this didnt work
js StartupEvents.registry('item', event => { event.create('corn_delight:cornbread') .food(food => { food .hunger(20) .saturation(30) .fastToEat(true) }).maxStackSize(3) })
it should 
oh damnn
event.modify('corn_delight:cornbread', item => {
let foodInfo = item.getFoodInfo()
let field = item.getClass().getDeclaredField("info")
field.setAccessible(true)
// calories seems to be saturation
let caloriedField = foodInfo.getClass().getDeclaredField("caloried")
caloriedField.setAccessible(true)
caloriedField.setFloat(foodInfo, 32) // calories is a float
})
that would be the reflection example
I have no clue what hunger is in their FoodInfo
whatever this stuff is

why do they do this
no clue
wow that is certainly something
amount is probably hunger?
oh maybe for addon mods like that one mod that requires a "balanced diet"
yea thats prob why they have the other goofy stuff aswell
i guess
event.modify('corn_delight:cornbread', item => {
let foodInfo = item.getFoodInfo()
let field = item.getClass().getDeclaredField("info")
field.setAccessible(true)
// calories seems to be saturation
let caloriesField = foodInfo.getClass().getDeclaredField("calories")
caloriesField.setAccessible(true)
caloriesField.setFloat(foodInfo, 0.5) // calories is a float
let amountField = foodInfo.getClass().getDeclaredField("amount")
amountField.setAccessible(true)
amountField.setInt(foodInfo, 10) // calories is a float
let eatTimeField = foodInfo.getClass().getDeclaredField("eatTime")
eatTimeField.setAccessible(true)
eatTimeField.setInt(foodInfo, 16) // 16 is for fast eat
})
that should be all three fields
thank you brotha
its alright



