mojira.dev
MC-259838

Decomposed transformation sometimes requires all properties to be set

When setting the transformation property in the summon or data modify command in the decomposed (TAG_Compound) form, all four properties are required; otherwise, the entire object is set to default and an error is logged. This requirement does not exist for the data merge command. Setting the transformation property in the matrix (TAG_List) form works as expected.

As an example, the following two commands do not work as expected:

/summon minecraft:block_display ~ ~ ~ {block_state:{Name:"minecraft:lime_glazed_terracotta"},transformation:{scale:[2f,2f,2f]}}
/data modify entity @e[type=minecraft:block_display,limit=1,sort=nearest] transformation set value {scale:[2f,2f,2f]}

Whereas the following do work as expected:

  • Specifying all four properties:

/summon minecraft:block_display ~ ~ ~ {block_state:{Name:"minecraft:lime_glazed_terracotta"},transformation:{translation:[0f,0f,0f],left_rotation:[0f,0f,0f,1f],scale:[2f,2f,2f],right_rotation:[0f,0f,0f,1f]}}
/data modify entity @e[type=minecraft:block_display,limit=1,sort=nearest] transformation set value {translation:[0f,0f,0f],left_rotation:[0f,0f,0f,1f],scale:[2f,2f,2f],right_rotation:[0f,0f,0f,1f]}
  • Using matrix form:

/summon minecraft:block_display ~ ~ ~ {block_state:{Name:"minecraft:lime_glazed_terracotta"},transformation:[2f,0f,0f,0f,0f,2f,0f,0f,0f,0f,2f,0f,0f,0f,0f,1f]}
/data modify entity @e[type=minecraft:block_display,limit=1,sort=nearest] transformation set value {scale:[2f,0f,0f,0f,0f,2f,0f,0f,0f,0f,2f,0f,0f,0f,0f,1f]}
  • Modifying a specific property:

/data modify entity @e[type=minecraft:block_display,limit=1,sort=nearest] transformation.scale set value [2f,2f,2f]
  • Using data merge:

/data merge entity @e[type=minecraft:block_display,limit=1,sort=nearest] {transformation:{scale:[2f,2f,2f]}}

Expected behaviour

The command summons an entity with the specified transformation values set, and the unspecified values set to default.

Actual behaviour

Upon running the command, the following error message is logged by the server thread:

Display entityNot a list: {scale:[2.0f,2.0f,2.0f]}

The entity has the default appearance, and all of its transformation data is set to their default values.

Linked issues

Comments 9

When setting the transformation using the decomposed forms, you need to put all 4 parts, they are not optional. For example this command would work:

/summon minecraft:block_display ~ ~ ~ {block_state:{Name:"minecraft:lime_glazed_terracotta"},transformation:{translation:[0.0f,0.0f,0.0f],left_rotation:[0.0f,0.0f,0.0f,1.0f],scale:[2f,2f,2f],right_rotation:[0.0f,0.0f,0.0f,1.0f]}}

That's just weird, that also means execute store wouldn't ever work.

It might be weird, but imo requesting that the other fields are made optional would be a feature request. execute store still works, for example:

/execute store result score scale temp run data get entity @e[type=block_display,limit=1,sort=nearest] transformation.scale[1] 100

It's not a feature request though, it's an inconsistency; nowhere elsd in the game do you require to provide other tags when attempting to change one of them.

Interesting. For the data merge command specifying all properties is not a requirement though, it's only summon and data modify.

Code analysis using Yarn mappings:

The codec stored in the AffineTransformation.field_42532 field does not have optional fields, so attempting to parse an incomplete transformation compound will result in an error being logged to the console instead.

This may be WAI. Quite a few players think that's why mojang added /execute summon. Also in the update log it said: (/execute summon is) meant to simplify entity setup and reduce need for raw NBT editing.

To simply summon the entity, we can use

/execute summon <id> run data merge entity @s {transformation:{scale:[4.0,4.0,4.0]}}

 

But that's just players' guess, and it's up to mojang to decide if it's intentional.

Why exactly is this intended? This is the only NBT to not accept non-full data, all other NBT will set the fields correctly and default the ignored values.

Quote from @unknown in the Minecraft Commands Discord server (link, 2022-02-12):

IMO :works_as_intended:-ish. Codec always expects all the fields, it's just that most of the time you use merge or set single field, so other ones are already there. But with /summon or replacing whole transformation, it's no longer the case.

JochCool

(Unassigned)

Confirmed

Commands

23w06a, 1.19.4 Pre-release 1

Retrieved