-
Bug
-
Resolution: Duplicate
-
None
-
1.20.80.23 Preview
-
None
-
Unconfirmed
-
Windows
According to the [official docs|https://learn.microsoft.com/en-us/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_damage?view=minecraft-bedrock-stable] the "minecraft:damage" component supports an integer type. However, upon further testing, it seems to be using a signed 16-bit integer. This causes certain ranges of values to appear as negative which causes the Bedrock Engine to think the value is a negative number, even if the value is a positive number.
This occurs due to the 2's complements for 16-bit integer. The negative ranges formula is, inclusive beginning and exclusive ending where x can be any arbitrary number.
[256*(256x+128), 256*(256(x+1)))
As an example, if x is 0, the range for negative values are [32768, 65536) which the below reproduction method below supports
Reproduce:
- Download the attached pack below
- Import the pack into Preview 1.20.80.23
- Enable the Content Log GUI by going to Settings > Creator > Enable Content Log GUI
- Give yourself the following items:
- mojira:damage_32767
- mojira:damage_32768
- mojira:damage_32769
- mojira:damage_65536
- Open your inventory and hover over the items
Expected Result:
- mojira:damage_32767 should have a "+255 attack damage" tooltip due to a related bug(MCPE-180073)
- mojira:damage_32768 should have no "attack damage" tooltip due to a related bug(MCPE-180073)
- mojira:damage_32769 should have a "+1 attack damage" tooltip due to a related bug(MCPE-180073)
- mojira:damage_32769 should have no "attack damage" tooltip due to a related bug(MCPE-180073)
Actual Result:
- mojira:damage_32767 has a "+255 attack damage" tooltip. The item does parse correctly.
- mojira:damage_32768 throws a content log error. The item does not parse correctly thus rendering the item broken.
- mojira:damage_32769 throws a content log error. The item does not parse correctly thus rendering the item broken.
- mojira:damage_65536 has no "attack damage" tooltip. The item does parse correctly.
- For the items that do not parse correctly, a message in the Content Log should appear matching the screenshot attached below
- duplicates
-
MCPE-180073 "minecraft:damage" component value has unexpected integer behaviour
- Open