Remove foodbenefits and use rely on kubejs + hunger strike

This commit is contained in:
2026-03-07 04:49:19 -07:00
parent d5938858bd
commit 5498d90683
97 changed files with 1294 additions and 1121 deletions

View File

@@ -9,7 +9,7 @@
mode = "ALL"
#How to translate food points into heart points when consuming food.
#At the default value of 0.5, food fills your heart bar at half the rate it would fill hunger.
foodHealFactor = 0.0
foodHealFactor = 0.5
#Globally overrides the maximum stack size of food items.
#This property affects all Vanilla and Mod food items that derive from ItemFood.
#Set to -1 to retain the default stack size of each food item. Note: This will affect the entire server, not just players on hunger strike.

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:jump_boost",
"time": 80,
"level": 7,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": false,
"heal": 2,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "feathers:energized",
"time": 1200,
"level": 7,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": false,
"heal": 4,
"harm": 0
}

View File

@@ -1,8 +0,0 @@
{
"effects": [
],
"cool_down": 0,
"always_edible": true,
"heal": 5,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:slowness",
"time": 200,
"level": 0,
"type": "remove",
"chance": 0.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 7,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "feathers:endurance",
"time": 600,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 7,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:health_boost",
"time": 600,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": false,
"heal": 7,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:resistance",
"time": 600,
"level": 0,
"type": "give",
"chance": 1
}
],
"cool_down": 0,
"always_edible": true,
"heal": 7,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:regeneration",
"time": 300,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": false,
"heal": 7,
"harm": 0
}

View File

@@ -1,7 +0,0 @@
{
"effects": [],
"cool_down": 0,
"always_edible": true,
"heal": 2,
"harm": 0
}

View File

@@ -1,22 +0,0 @@
{
"effects": [
{
"effect": "minecraft:night_vision",
"time": 400,
"level": 0,
"type": "give",
"chance": 1
},
{
"effect": "minecraft:luck",
"time": 150,
"level": 1,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 5,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:absorption",
"time": 200,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 5,
"harm": 0
}

View File

@@ -1,7 +0,0 @@
{
"effects": [],
"cool_down": 0,
"always_edible": true,
"heal": 12,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:speed",
"time": 1200,
"level": 0,
"type": "give",
"chance": 1
}
],
"cool_down": 0,
"always_edible": true,
"heal": 6,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:health_boost",
"time": 600,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": false,
"heal": 7,
"harm": 0
}

View File

@@ -1,22 +0,0 @@
{
"effects": [
{
"effect": "minecraft:mining_fatigue",
"time": 200,
"level": 0,
"type": "remove",
"chance": 0.0
},
{
"effect": "minecraft:slowness",
"time": 200,
"level": 0,
"type": "remove",
"chance": 0.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 6,
"harm": 0
}

View File

@@ -1,8 +0,0 @@
{
"effects": [
],
"cool_down": 0,
"always_edible": false,
"heal": 8,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:fire_resistance",
"time": 600,
"level": 0,
"type": "give",
"chance": 1
}
],
"cool_down": 0,
"always_edible": true,
"heal": 5,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "feathers:endurance",
"time": 600,
"level": 0,
"type": "give",
"chance": 1
}
],
"cool_down": 0,
"always_edible": false,
"heal": 5,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:absorption",
"time": 400,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": false,
"heal": 8,
"harm": 0
}

View File

@@ -1,7 +0,0 @@
{
"effects": [],
"cool_down": 0,
"always_edible": true,
"heal": 4,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "cofh_core:panacea",
"time": 200,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 4,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecaft:haste",
"time": 300,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 5,
"harm": 0
}

View File

@@ -1,7 +0,0 @@
{
"effects": [],
"cool_down": 0,
"always_edible": true,
"heal": 10,
"harm": 0
}

View File

@@ -1,7 +0,0 @@
{
"effects": [],
"cool_down": 0,
"always_edible": false,
"heal": 6,
"harm": 0
}

View File

@@ -1,7 +0,0 @@
{
"effects": [],
"cool_down": 0,
"always_edible": true,
"heal": 4,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:luck",
"time": 60,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 0,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:absorption",
"time": 600,
"level": 1,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 0,
"harm": 0
}

View File

@@ -1,7 +0,0 @@
{
"effects": [],
"cool_down": 0,
"always_edible": true,
"heal": 1,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:speed",
"time": 2400,
"level": 0,
"type": "give",
"chance": 1
}
],
"cool_down": 0,
"always_edible": true,
"heal": 2,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "feathers:energized",
"time": 20,
"level": 7,
"type": "give",
"chance": 1
}
],
"cool_down": 0,
"always_edible": false,
"heal": 1,
"harm": 0
}

View File

@@ -1,22 +0,0 @@
{
"effects": [
{
"effect": "minecraft:fire_resistance",
"time": 2400,
"level": 0,
"type": "give",
"chance": 1
},
{
"effect": "minecraft:instant_damage",
"time": 100,
"level": 0,
"type": "give",
"chance": 1
}
],
"cool_down": 0,
"always_edible": true,
"heal": 6,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:slow_falling",
"time": 200,
"level": 2,
"type": "give",
"chance": 1
}
],
"cool_down": 0,
"always_edible": false,
"heal": 3,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:glowing",
"time": 600,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 7,
"harm": 0
}

View File

@@ -1,7 +0,0 @@
{
"effects": [],
"cool_down": 0,
"always_edible": true,
"heal": 2,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:strength",
"time": 600,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 10,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:water_breathing",
"time": 300,
"level": 0,
"type": "give",
"chance": 1
}
],
"cool_down": 0,
"always_edible": true,
"heal": 2,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:regeneration",
"time": 200,
"level": 0,
"type": "give",
"chance": 1
}
],
"cool_down": 0,
"always_edible": false,
"heal": 0,
"harm": 0
}

View File

@@ -1,7 +0,0 @@
{
"effects": [],
"cool_down": 0,
"always_edible": true,
"heal": 3,
"harm": 0
}

View File

@@ -1,7 +0,0 @@
{
"effects": [],
"cool_down": 0,
"always_edible": true,
"heal": 6,
"harm": 0
}

View File

@@ -1,7 +0,0 @@
{
"effects": [],
"cool_down": 0,
"always_edible": true,
"heal": 6,
"harm": 0
}

View File

@@ -1,7 +0,0 @@
{
"effects": [],
"cool_down": 0,
"always_edible": true,
"heal": 6,
"harm": 0
}

View File

@@ -1,7 +0,0 @@
{
"effects": [],
"cool_down": 0,
"always_edible": false,
"heal": 4,
"harm": 0
}

View File

@@ -1,7 +0,0 @@
{
"effects": [],
"cool_down": 0,
"always_edible": true,
"heal": 5,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:health_boost",
"time": 200,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 4,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:strength",
"time": 200,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 3,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:haste",
"time": 600,
"level": 0,
"type": "give",
"chance": 1
}
],
"cool_down": 0,
"always_edible": true,
"heal": 7,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "feathers:endurance",
"time": 600,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 7,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:poison",
"time": 20,
"level": 0,
"type": "remove",
"chance": 0.0
}
],
"cool_down": 0,
"always_edible": false,
"heal": 2,
"harm": 0
}

View File

@@ -1,8 +0,0 @@
{
"effects": [
],
"cool_down": 0,
"always_edible": false,
"heal": 5,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:nausea",
"time": 200,
"level": 0,
"type": "give",
"chance": 0.3
}
],
"cool_down": 0,
"always_edible": true,
"heal": 3,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:resistance",
"time": 100,
"level": 0,
"type": "give",
"chance": 0.7
}
],
"cool_down": 0,
"always_edible": true,
"heal": 1,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:resistance",
"time": 300,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 8,
"harm": 0
}

View File

@@ -1,8 +0,0 @@
{
"effects": [
],
"cool_down": 0,
"always_edible": false,
"heal": 5,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:night_vision",
"time": 100,
"level": 0,
"type": "give",
"chance": 0.7
}
],
"cool_down": 0,
"always_edible": true,
"heal": 1,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:nausea",
"time": 200,
"level": 0,
"type": "give",
"chance": 0.3
}
],
"cool_down": 0,
"always_edible": true,
"heal": 3,
"harm": 0
}

View File

@@ -1,7 +0,0 @@
{
"effects": [],
"cool_down": 0,
"always_edible": false,
"heal": 3,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:health_boost",
"time": 400,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": false,
"heal": 6,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:slow_falling",
"time": 40,
"level": 0,
"type": "give",
"chance": 0.8
}
],
"cool_down": 0,
"always_edible": true,
"heal": 4,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:water_breathing",
"time": 100,
"level": 0,
"type": "give",
"chance": 0.6
}
],
"cool_down": 0,
"always_edible": true,
"heal": 6,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:mining_fatigue",
"time": 200,
"level": 0,
"type": "remove",
"chance": 0.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 5,
"harm": 0
}

View File

@@ -1,8 +0,0 @@
{
"effects": [
],
"cool_down": 0,
"always_edible": false,
"heal": 6,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:jump_boost",
"time": 3200,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 4,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:dolphins_grace",
"time": 600,
"level": 0,
"type": "give",
"chance": 0.5
}
],
"cool_down": 0,
"always_edible": true,
"heal": 5,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:speed",
"time": 200,
"level": 0,
"type": "give",
"chance": 1
}
],
"cool_down": 0,
"always_edible": true,
"heal": 2,
"harm": 0
}

View File

@@ -1,8 +0,0 @@
{
"effects": [
],
"cool_down": 0,
"always_edible": true,
"heal": 1,
"harm": 0
}

View File

@@ -1,8 +0,0 @@
{
"effects": [
],
"cool_down": 25,
"always_edible": false,
"heal": 2,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:glowing",
"time": 4800,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 2,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:night_vision",
"time": 2400,
"level": 0,
"type": "give",
"chance": 1
}
],
"cool_down": 0,
"always_edible": true,
"heal": 4,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:absorption",
"time": 200,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 2,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:fire_resistance",
"time": 100,
"level": 0,
"type": "give",
"chance": 0.9
}
],
"cool_down": 0,
"always_edible": true,
"heal": 2,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:weakness",
"time": 20,
"level": 0,
"type": "remove",
"chance": 0.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 16,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:nausea",
"time": 200,
"level": 0,
"type": "give",
"chance": 0.3
}
],
"cool_down": 0,
"always_edible": true,
"heal": 3,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:nausea",
"time": 200,
"level": 0,
"type": "give",
"chance": 0.3
}
],
"cool_down": 0,
"always_edible": true,
"heal": 3,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:luck",
"time": 60,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 6,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:nausea",
"time": 200,
"level": 0,
"type": "give",
"chance": 0.3
}
],
"cool_down": 0,
"always_edible": true,
"heal": 2,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:haste",
"time": 600,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 16,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:nausea",
"time": 200,
"level": 0,
"type": "give",
"chance": 0.3
}
],
"cool_down": 0,
"always_edible": true,
"heal": 3,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:poison",
"time": 10,
"level": 0,
"type": "remove",
"chance": 0.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 8,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:nausea",
"time": 200,
"level": 0,
"type": "give",
"chance": 0.3
}
],
"cool_down": 0,
"always_edible": true,
"heal": 1,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:hunger",
"time": 20,
"level": 0,
"type": "remove",
"chance": 0.0
}
],
"cool_down": 0,
"always_edible": false,
"heal": 2,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:dolphin_grace",
"time": 200,
"level": 0,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 4,
"harm": 0
}

View File

@@ -1,15 +0,0 @@
{
"effects": [
{
"effect": "minecraft:health_boost",
"time": 300,
"level": 1,
"type": "give",
"chance": 1.0
}
],
"cool_down": 0,
"always_edible": true,
"heal": 7,
"harm": 0
}

View File

@@ -1,7 +0,0 @@
{
"effects": [],
"cool_down": 20,
"always_edible": true,
"heal": 4,
"harm": 0
}

View File

@@ -1,7 +0,0 @@
{
"effects": [],
"cool_down": 0,
"always_edible": true,
"heal": 2,
"harm": 0
}

View File

@@ -1,7 +0,0 @@
{
"effects": [],
"cool_down": 0,
"always_edible": true,
"heal": 2,
"harm": 0
}

View File

@@ -1,7 +0,0 @@
{
"effects": [],
"cool_down": 0,
"always_edible": true,
"heal": 1,
"harm": 0
}

View File

@@ -1,7 +0,0 @@
{
"effects": [],
"cool_down": 25,
"always_edible": true,
"heal": 1,
"harm": 0
}

View File

@@ -5,5 +5,7 @@
"entity.minecraft.villager.sawmill.carpenter": "Carpenter",
"entity.minecraft.villager.carpenter": "Carpenter",
"subtitles.sawmill.entity.villager.work_carpenter": "Carpenter works",
"subtitles.sawmill.ui.sawmill.take_result": "Cutter used"
"subtitles.sawmill.ui.sawmill.take_result": "Cutter used",
"tooltip.kubejs.effect.applied": "When Applied:"
}

View File

@@ -0,0 +1,12 @@
{
"providers": [
{
"type": "bitmap",
"file": "pwb:font/healing.png",
"ascent": 7,
"chars": [
"0123456789abcdef"
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

View File

@@ -1607,7 +1607,7 @@
B = [0.0, 0.0, 1.22]
[client.improved_tooltips]
"Attribute Tooltips" = true
"Attribute Tooltips" = false
"Food Tooltips" = false
"Shulker Tooltips" = true
"Map Tooltips" = true
@@ -1618,7 +1618,7 @@
"Map Require Shift" = false
#The value of each shank of food.
#Tweak this when using mods like Hardcore Hunger which change that value.
"Food Divisor" = 2
"Food Divisor" = 4
"Show Saturation" = false
"Food Compression Threshold" = 4
"Fuel Time Divisor" = 200

View File

@@ -0,0 +1,146 @@
let data = JsonIO.read('kubejs/config/food.json') // GSON object
const MobEffectInstance = Java.loadClass('net.minecraft.world.effect.MobEffectInstance')
console.log('Loaded tooltips')
const nutritionTooltip = (item, lines) => {
let healing = item.foodProperties.getNutrition() / 2
if(healing == 0) {
return
}
let codes = '0'.repeat(parseInt(healing / 2))
if(healing % 2) {
codes += '1'
}
lines.add(1, { text: codes, font: "pwb:healing" })
// return [ { text: codes, font: "pwb:healing" } ]
}
const formatDuration = duration => {
let ticks = parseInt(duration / 20)
let minute = Math.floor(ticks / 60).toString().padStart(2, '0')
let seconds = parseInt(ticks % 60).toString().padStart(2, '0')
return minute + ':' + seconds
}
const formatEffect = mobEffect => {
const effect = mobEffect.effect
return {
color: effect.beneficial ? "blue" : "red",
text: `${effect.displayName.getString()} (${formatDuration(mobEffect.duration)})`
}
}
const formatChance = chance => {
return {
text: Math.floor(chance * 100) + "% "
}
}
const givesEffectTooltip = (mobEffect, chance, lines) => {
let components = []
if(chance < 1) {
components.push(formatChance(chance))
}
components.push(formatEffect(mobEffect))
lines.push(components)
// lines.add(components)
}
const queueAttributeTooltips = (mobEffect, attrLines) => {
mobEffect.effect.attributeModifiers.forEach((attribute, modifier) => {
let attrName = Text.translate(attribute.descriptionId).getString();
let prefix = "+"
if (modifier.operation.ordinal() == 0) {
let amount = modifier.amount;
prefix += Number.isInteger(amount) ? amount.toString() : amount.toFixed(2);
} else {
let amount = modifier.amount * 100;
prefix += Number.isInteger(amount) ? amount.toString() : amount.toFixed(2);
prefix += "%"
}
let effectString = modifier.amount > 0 ? "§9" : "§c";
attrLines.push(`${effectString}${prefix} ${attrName}`)
})
}
const attributeTooltips = (lines, attrLines) => {
if (attrLines.length > 0) {
lines.add("")
lines.add({
translate: "tooltip.kubejs.effect.applied",
color: "dark_purple"
})
lines.addAll(attrLines)
}
}
const tooltipForCustomEffect = (dataEntry, lines, attrLines) => {
for(let effectDef of dataEntry.effects) {
switch(effectDef.type) {
case "give":
const mobEffect = new MobEffectInstance(effectDef.effect, effectDef.time, effectDef.level, false, false)
givesEffectTooltip(mobEffect, effectDef.chance, lines)
// queueAttributeTooltips(mobEffect, attrLines)
break
}
}
}
const hasFoodProperties = (stack) => {
let foodProperties = stack.item.foodProperties;
return foodProperties != null && !foodProperties.effects.isEmpty()
}
ItemEvents.tooltip(event => {
console.log('Reloading tooltips')
// for(let item of Ingredient.all.itemTypes.toArray()) {
// let foodProperties = item.foodProperties
// if(foodProperties == null) {
// continue
// }
// event.add(nutritionTooltip(item))
// }
event.addAdvanced(Ingredient.all.itemIds, (stack, advanced, lines) => {
let foodProperties = stack.item.foodProperties
if(foodProperties == null) {
return
}
// let attrLines = []
nutritionTooltip(stack.item, lines)
// let dataEntry = data[stack.item.arch$registryName().toString()]
// if(dataEntry != null) {
// tooltipForCustomEffect(dataEntry, lines, attrLines)
// }
// attributeTooltips(lines, attrLines)
})
for(let itemId of Object.keys(data)) {
let lines = []
tooltipForCustomEffect(data[itemId], lines)
event.add(itemId, lines)
}
// const addEffect = (targets, effects) => {
// }
// for(let id in data) {
// console.log(id)
// addEffect(id, data[id].effects)
// }
})

1112
pack/kubejs/config/food.json Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
let data = JsonIO.read('kubejs/config/food.json')
ItemEvents.modification(event => {
event.modify(Object.keys(data), item => {
item.foodProperties = food => {
let dataEntry = data[item.arch$registryName().toString()]
food.hunger(dataEntry.heal * 2)
for(let effectDef of dataEntry.effects) {
switch(effectDef.type) {
case "give":
food.effect(effectDef.effect, effectDef.time, effectDef.level, effectDef.chance)
break
}
}
}
})
})

Binary file not shown.