-
Bug
-
Resolution: Invalid
-
None
-
Minecraft 1.12.2
-
Unconfirmed
I noticed the attributes which modify the health aren't the same.
For example, in a "give" command, we use an attribute to modify total health to -90%.
For this, I use "Operation:2".
Command:
/give @p minecraft:diamond_sword 1 0 {AttributeModifiers:[
]}
Default world. No other commands. When I hold this sword, my hearts are reduced from 10 to 1, which makes sense. (10-90%=1)
Now to the problem part:
With loot tables we create the same diamond sword with -90% health attribute.
For this we create a new loot table. (DOWNLOAD the .zip and place into your world in /data)
However instead of "Operation:2", it uses the "multiply_total", and we add the amount -0.9.
Ingame, when we hold the sword the health is supposed to be 1 heart. (10-90%=1)
HOWEVER, it shows 2 hearts.
PROBLEM: It shows 2 hearts, bcs the code likes for some reason to change your amout you enter to a really close one. Example here: I entered "-0.9" and when the loot was generated, the item had an amout of "-0.899999..." (Look at the SCREENSHOT here.)
This was a test, basicly the generated items wont take the numbers entered 1:1, eventhough it is clearly defined in the loot table. The true, generated number is always a really close one to the entered number, which can mess things up.
Pool:
{ "pools": [ { "rolls": 1, "entries": [ { "type": "item", "weight": 1, "name": "minecraft:diamond_sword", "functions": [ { "function": "set_attributes", "modifiers": [ { "attribute": "generic.maxHealth", "operation": "multiply_total", "amount": -0.9, "name": "Health", "slot": "mainhand" } ] } ] } ] } ] }
I hope I explained it somehow clear enough to understand.