29 lines
1.1 KiB
JavaScript
29 lines
1.1 KiB
JavaScript
StartupEvents.registry("item", (event) => {
|
|
event.create("golden_potato").food((food) => {
|
|
food
|
|
.hunger(18)
|
|
.saturation(18) //This value does not directly translate to saturation points gained
|
|
//The real value can be assumed to be:
|
|
//min(hunger * saturation * 2 + saturation, foodAmountAfterEating)
|
|
.effect("speed", 600, 0, 1)
|
|
.effect("health_boost", 600, 0, 1)
|
|
.effect("luck",600,0,1)
|
|
.effect("strength",600,0,1)
|
|
.removeEffect("poison")
|
|
.alwaysEdible() //Like golden apples
|
|
.fastToEat() //Like dried kelp
|
|
.meat() //Dogs are willing to eat it
|
|
.eaten((ctx) => {
|
|
//runs code upon consumption
|
|
ctx.player.tell(Text.gold("Yummy Yummy!"));
|
|
//If you want to modify this code then you need to restart the game.
|
|
//However, if you make this code call a global startup function
|
|
//and place the function *outside* of an event handler
|
|
//then you may use the command:
|
|
// /kubejs reload startup_scripts
|
|
//to reload the function instantly.
|
|
//See example below
|
|
});
|
|
});
|
|
});
|