Skip to content

Slicing decimal numbers ending in ".000..." #1162

@claudal

Description

@claudal

Summary
When one writes a float number ending in ".0" to a JSON file. Then Bridge copies the code to the game folder with these decimals removed.
The problem with this is, when using entity float properties and setting a range or the default value with a ".0", then the game gives an error (the "Error loading property: 'default'/'range' value/array does not match the specified type 'float'"). Since it requires that these values ​​include the decimals that Bridge removes.

To Reproduce

  1. Create/modify an entity in Bridge.
  2. Add an entity property of type float.
  3. Enter a float number ending in ".0" in "default" or within the range. For example:

"example:remaining_fuel": {
"type": "float",
"range": [0.0, 30.0],
"default": 0.0
}

  1. Save the file and start a world in Minecraft with the test entity

Observed behavior
Minecraft throws the error "Error loading property: 'default'/'range' value/array does not match the specified type 'float'". And when one check the entity file in the game folder, the property's decimal numbers will not have the ".0" (the cause of the error in the game)
Expected behavior
Bridge saves the entity file inside the folder without removing the ".0" from the property. And Minecraft starts the world without a properties error

Screenshots / File Attachments
Example entity file:
entity_example.json

Property in Bridge:
image
Property in game folder:
image
Game error:
image

Platform:

  • OS: Windows 10
  • App Version: 2.7.28

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

Status

🚀 Done

Relationships

None yet

Development

No branches or pull requests

Issue actions