We've split up the commands, scripting and mods, and add ons category! Please be sure you get your thread in the right place.

83

Add a math parameter to /data modify

3 Comments

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.