Commands let players perform actions and customize gameplay using text-based instructions. Use this topic to share feedback and ideas for improving commands and related tools.

84

Add a math parameter to /data modify

4 Comments

Post a new comment:

Please sign in to leave a comment.

Sorted by oldest
  • 5
    Registered User commented
    Comment actions Permalink

    That is great idea! Well thought.
    Mainly because dealing with "doubles" in scoreboards is horrible...

  • 1
    Registered User commented
    Comment actions Permalink

    I sorta agree with you, but ^ means xor in some programing languages like c and c#

     (im not sure about java)

    and | means or, i think these should be inmplemented in both modify functions along with & for bitwise and operations and << >> for bitshift operations.

    until this gets implemented I'd recommend you using 

     /execute store result score <entityname> <objectivename> run data get entity <entity with your nbt> <path to your nbt>

    to dump the nbt into a scoreboard and

    /execute store result entity <entity you want to store your score in> <your score> <datatype of your score> 1 run scoreboard players get <entity your score is saved in> <objectivename>

    to do the opposite, then you can use scoreboard operations on the scores

  • 0
    Registered User commented
    Comment actions Permalink

    This seems like a great idea, especially for working with types like longs, floats and doubles, which you can usually not do math with without losing precision.

    Just a detail, but I'd make it so that the result of the operation is converted back to the type of the input, so for example adding 2 to 3.5d would result in 5.5d and adding 3.5d to 2 would result in 5. The reason for that is that types need to be consistent in lists and therefore putting a double into a list of ints would fail.

  • 0
    Registered User commented
    Comment actions Permalink

    终于接近的要拥有一个真正的变量系统了,这是一件好事。