Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-116928

Command block and spawner minecart data fixer not working correctly


    • Confirmed

      Based on 1.11.2 decompiled using MCP 9.35 rc1 and 17w17a decompiled using CFR

      The bug

      The command block and spawner minecart data fixer are not working correctly.

      Command block minecart

      First of all the method net.minecraft.entity.item.EntityMinecartCommandBlock.registerFixesMinecartCommand(DataFixer) compares the id value with the current id of the command block block entity, which will always fail. It should compare it with the id of the EntityMinecartCommandBlock (see EntityMinecartMobSpawner.registerFixesMinecartMobSpawner(DataFixer)).

      The second problem is that it sets the old block entity id (Control) when trying to apply command block fixes. This fails when trying to fix chunks which were loaded after the block entity id changes. Another problem is that it sets the old command block minecart entity as well which would result in them being lost upon loading old worlds.

      Spawner minecart

      While the method net.minecraft.entity.item.EntityMinecartMobSpawner.registerFixesMinecartMobSpawner(DataFixer) uses the entity id, it always uses the latest. The problem is that there were changes to the NBT data of spawner when the old entity ids were used. This means trying to load a pre-1.9 world with spawner minecarts will not fix these.

      How to reproduce

      1. Create a world in version 1.8.9
      2. Place a spawner
        /setblock ~ ~ ~ mob_spawner 0 replace {SpawnData:{Color:1b},EntityId:"Sheep"}
      3. Summon a spawner minecart
        /summon MinecartSpawner ~ ~ ~ {EntityId:ArmorStand,MinSpawnDelay:10s,MaxSpawnDelay:10s,SpawnCount:1}
      4. Open the world in the latest version
        → The spawners were fixed, but the spawner minecarts lost their data

      General problem

      The problem in general is that some fixes might apply to versions where the ids where different. Therefor setting the latest block entity id will not apply the fixes. However, setting only the old id would cause problems with fixes after the id changes. This means it would be good to set the id based on the passed data version. To not have special cases and possibly miss one with new versions or if a fix for an old version was forgotten and added later some kind of id lookup to get the respective id for a version should solve this problem.

            fry [Mojang] Georgii Gavrichev
            marcono1234 [Mod] Marcono1234
            4 Vote for this issue
            3 Start watching this issue