@@ -19,7 +19,7 @@ public class World
1919 /// <summary>
2020 /// The dimension info of the world
2121 /// </summary>
22- private static Dimension curDimension = new ( ) ;
22+ private static Dimension curDimension = new ( ) ;
2323
2424 private static readonly Dictionary < string , Dimension > dimensionList = new ( ) ;
2525
@@ -87,10 +87,32 @@ public static void StoreOneDimension(string dimensionName, Dictionary<string, ob
8787 /// </summary>
8888 /// <param name="name"> The name of the dimension type</param>
8989 /// <param name="nbt">The dimension type (NBT Tag Compound)</param>
90- public static void SetDimension ( string name )
91- {
92- curDimension = dimensionList [ name ] ; // Should not fail
93- }
90+ public static void SetDimension ( string name )
91+ {
92+ // Try to get the dimension using the name as is
93+ if ( dimensionList . TryGetValue ( name , out Dimension dimension ) )
94+ {
95+ curDimension = dimension ;
96+ return ; // Dimension found
97+ }
98+
99+ // If not found, check if name lacks 'minecraft:' prefix and try again
100+ if ( ! name . StartsWith ( "minecraft:" ) )
101+ {
102+ string prefixedName = "minecraft:" + name ;
103+ if ( dimensionList . TryGetValue ( prefixedName , out dimension ) )
104+ {
105+ curDimension = dimension ;
106+ return ; // Dimension found with prefixed name
107+ }
108+ }
109+
110+ // If still not found, dimension does not exist
111+ throw new KeyNotFoundException ( $ "Dimension '{ name } ' not found in dimensions dictionary.") ;
112+ }
113+
114+
115+
94116
95117
96118 /// <summary>
0 commit comments