Okay, let's build this from scratch together, step by step! ✨
I understand you want a placeholder that:
- Reads the player's current food saturation level. This is a numeric value that indicates how much saturation the player has.
- Multiplies that number by 5.
Here's how we construct it:
Step 1: Get the Player's Food Saturation Level
To get data from the player (an entity), we use the nbt_data_get placeholder. This placeholder allows us to access NBT (Named Binary Tag) data. For player-specific NBT data, we use the entity source_type and @s (which stands for "self," referring to the current player) for entity_selector. The specific NBT path for food saturation is foodSaturationLevel.
Here's the placeholder for that:
{"placeholder":"nbt_data_get","values":{"source_type":"entity","entity_selector":"@s","nbt_path":"foodSaturationLevel"}}
This will return a number, like 5.0 or 10.5.
Step 2: Perform the Multiplication
Now that we have the saturation level, we need to multiply it by 5. For any mathematical operation, we use FancyMenu's calc (calculator) placeholder.
The calc placeholder needs two main things:
"decimal":"true" or "false": Do we want the result to include decimal points? Yes, saturation can be a decimal, so we want this to be true.
"expression":"your_calculation_here": This is where we put our math problem.
Inside the expression, we'll embed the placeholder from Step 1.
So, the basic structure for the calc placeholder will be:
{"placeholder":"calc","values":{"decimal":"true","expression":" [PLACEHOLDER_FROM_STEP_1] * 5 "}}
Step 3: Combine Them!
Now, let's take the placeholder from Step 1 and insert it directly into the expression part of the calc placeholder from Step 2: