3131import com .viaversion .viabackwards .protocol .v1_21_6to1_21_5 .provider .ChestDialogViewProvider ;
3232import com .viaversion .viabackwards .protocol .v1_21_6to1_21_5 .storage .RegistryAndTags ;
3333import com .viaversion .viabackwards .protocol .v1_21_6to1_21_5 .storage .ServerLinks ;
34+ import com .viaversion .viaversion .util .Key ;
3435import java .util .ArrayList ;
3536import java .util .List ;
3637import java .util .Locale ;
@@ -89,12 +90,12 @@ public Dialog(final RegistryAndTags registryAndTags, final ServerLinks serverLin
8990 }
9091 }
9192
92- switch (type ) {
93- case "minecraft: notice" -> fillNoticeDialog (tag );
94- case "minecraft: server_links" -> fillServerLinksDialog (serverLinks , tag );
95- case "minecraft: dialog_list" -> fillDialogList (registryAndTags , serverLinks , tag );
96- case "minecraft: multi_action" -> fillMultiActionDialog (tag );
97- case "minecraft: confirmation" -> fillConfirmationDialog (tag );
93+ switch (Key . stripMinecraftNamespace ( type ) ) {
94+ case "notice" -> fillNoticeDialog (tag );
95+ case "server_links" -> fillServerLinksDialog (serverLinks , tag );
96+ case "dialog_list" -> fillDialogList (registryAndTags , serverLinks , tag );
97+ case "multi_action" -> fillMultiActionDialog (tag );
98+ case "confirmation" -> fillConfirmationDialog (tag );
9899 default -> throw new IllegalArgumentException ("Unknown dialog type: " + type + " in tag: " + tag );
99100 }
100101 }
@@ -105,9 +106,9 @@ private void fillBodyWidget(final CompoundTag tag) {
105106 throw new IllegalArgumentException ("Dialog type is missing in tag: " + tag );
106107 }
107108
108- if (type .equals ("minecraft: plain_message" )) {
109+ if (Key . stripMinecraftNamespace ( type ) .equals ("plain_message" )) {
109110 widgets .add (new TextWidget (tag ));
110- } else if (type .equals ("minecraft: item" )) {
111+ } else if (Key . stripMinecraftNamespace ( type ) .equals ("item" )) {
111112 widgets .add (new ItemWidget (tag ));
112113 } else {
113114 throw new IllegalArgumentException ("Unknown dialog body type: " + type + " in tag: " + tag );
@@ -120,11 +121,11 @@ private void fillInputWidget(final CompoundTag tag) {
120121 throw new IllegalArgumentException ("Dialog type is missing in tag: " + tag );
121122 }
122123
123- widgets .add (switch (type ) {
124- case "minecraft: boolean" -> new BooleanInput (tag );
125- case "minecraft: number_range" -> new NumberRangeInput (tag );
126- case "minecraft: single_option" -> new SingleOptionInput (tag );
127- case "minecraft: text" -> new TextInput (tag );
124+ widgets .add (switch (Key . stripMinecraftNamespace ( type ) ) {
125+ case "boolean" -> new BooleanInput (tag );
126+ case "number_range" -> new NumberRangeInput (tag );
127+ case "single_option" -> new SingleOptionInput (tag );
128+ case "text" -> new TextInput (tag );
128129 default -> throw new IllegalArgumentException ("Unknown dialog input type: " + type + " in tag: " + tag );
129130 });
130131 }
0 commit comments