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

Structure palette variant selection looks faulty

    XMLWordPrintable

    Details

    • Confirmation Status:
      Confirmed
    • Category:
      Structures
    • Mojang Priority:
      Normal

      Description

      The bug

      Structures can provide multiple palette variants, however their selection looks faulty:
      (MCP: net.minecraft.world.gen.feature.template.PlacementSettings.func_204764_a(List<List<BlockInfo>>, BlockPos))

      18w49a, ccf.java
      public List<cci.b> a(List<List<cci.b>> list, @Nullable et et2) {
          this.j = 8;
          if (this.j != null && this.j >= 0 && this.j < list.size()) {
              return list.get(this.j);
          }
          this.j = this.b(et2).nextInt(list.size());
          return list.get(this.j);
      }
      

      There are two checks (non-null and >= 0) which will always succeed. And for structures with more than 8 palette variants (currently not the case for vanilla structures) always the 9th palette variant is loaded.

      How to reproduce

      Seems like variant selection is position dependent, therefore the following steps load the structure at multiple positions.

      Structures have to be placed inside the generated/minecraft/structures directory of a world.

      1. Load the structure 8-variants.nbt at multiple positions
        /fill ~1 ~1 ~1 ~10 ~1 ~10 structure_block[mode=load]{mode:"LOAD",posX:0,posY:1,posZ:0,sizeX:1,sizeY:1,sizeZ:1,name:"8-variants"}
        
        /fill ~1 ~ ~1 ~10 ~ ~10 redstone_block
        

        Different wool types are placed

      2. Load the structure 9-variants.nbt at multiple positions
        /fill ~1 ~1 ~1 ~10 ~1 ~10 structure_block[mode=load]{mode:"LOAD",posX:0,posY:1,posZ:0,sizeX:1,sizeY:1,sizeZ:1,name:"9-variants"}
        
        /fill ~1 ~ ~1 ~10 ~ ~10 redstone_block
        

        It always places the 9th variant, light gray wool

      How to verify code-wise

      1. Decompile Minecraft or use a viewer such as Bytecode Viewer
      2. Search for the string
        fossil/spine_1
        
      3. In the source look for the first line of code containing
        16 - 
        
      4. Open the type of the local variable two lines above
      5. Search for a method containing
         = 8;
        

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            marcono1234 [Mod] Marcono1234
            Votes:
            7 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              CHK: