@@ -55,14 +55,12 @@ func (c *converter) SetBlockByStatesString(blockName string, blockStatesString s
5555// SetBlockLegacy ..
5656func (c * converter ) SetBlockLegacy (blockName string , blockData uint16 ) error {
5757 copiedStates := make (map [string ]any )
58- if ! strings .HasPrefix (blockName , "minecraft:" ) {
59- blockName = "minecraft:" + blockName
60- }
58+ blockName = strings .TrimPrefix (blockName , "minecraft:" )
6159
6260 temp , found := blocks .LegacyBlockToRuntimeID (blockName , blockData )
6361 if ! found {
6462 newItem := itemupgrader .Upgrade (itemupgrader.ItemMeta {
65- Name : blockName ,
63+ Name : "minecraft:" + blockName ,
6664 Meta : int16 (blockData ),
6765 })
6866 if err := c .SetBlockByStatesString (newItem .Name , "[]" ); err != nil {
@@ -71,10 +69,10 @@ func (c *converter) SetBlockLegacy(blockName string, blockData uint16) error {
7169 return nil
7270 }
7371
74- name , states , _ := blocks .RuntimeIDToState (temp )
75- maps .Copy (copiedStates , states )
72+ blockName , blockStates , _ := blocks .RuntimeIDToState (temp )
73+ maps .Copy (copiedStates , blockStates )
7674
77- err := c .SetBlock (name , copiedStates )
75+ err := c .SetBlock (blockName , copiedStates )
7876 if err != nil {
7977 return fmt .Errorf ("SetBlockLegacy: %v" , err )
8078 }
0 commit comments