@@ -85,12 +85,20 @@ final class CraftBukkitAccess {
8585 findMcClassName ("core.IRegistryWritable" ),
8686 findMcClassName ("core.WritableRegistry" )
8787 );
88+ static final @ Nullable MethodHandle NEW_RESOURCE_LOCATION ;
89+
90+ static {
91+ MethodHandle newResourceLocation = findConstructor (CLASS_RESOURCE_LOCATION , String .class , String .class );
92+ if (newResourceLocation == null ) {
93+ newResourceLocation = searchMethod (CLASS_RESOURCE_LOCATION , Modifier .PUBLIC | Modifier .STATIC , "fromNamespaceAndPath" , CLASS_RESOURCE_LOCATION , String .class , String .class );
94+ }
95+ NEW_RESOURCE_LOCATION = newResourceLocation ;
96+ }
8897
8998 private CraftBukkitAccess () {
9099 }
91100
92101 static final class Chat1_19_3 {
93- static final @ Nullable MethodHandle NEW_RESOURCE_LOCATION = findConstructor (CLASS_RESOURCE_LOCATION , String .class , String .class );
94102 static final @ Nullable MethodHandle RESOURCE_KEY_CREATE = searchMethod (CLASS_RESOURCE_KEY , Modifier .PUBLIC | Modifier .STATIC , "create" , CLASS_RESOURCE_KEY , CLASS_RESOURCE_KEY , CLASS_RESOURCE_LOCATION );
95103 static final @ Nullable MethodHandle SERVER_PLAYER_GET_LEVEL = searchMethod (CraftBukkitFacet .CRAFT_PLAYER_GET_HANDLE .type ().returnType (), Modifier .PUBLIC , "getLevel" , CLASS_SERVER_LEVEL );
96104 static final @ Nullable MethodHandle SERVER_LEVEL_GET_REGISTRY_ACCESS = searchMethod (CLASS_SERVER_LEVEL , Modifier .PUBLIC , "registryAccess" , CLASS_REGISTRY_ACCESS );
@@ -224,7 +232,6 @@ static boolean isSupported() {
224232
225233 static final class EntitySound_1_19_3 {
226234
227- static final @ Nullable MethodHandle NEW_RESOURCE_LOCATION = findConstructor (CLASS_RESOURCE_LOCATION , String .class , String .class );
228235 static final @ Nullable MethodHandle REGISTRY_GET_OPTIONAL = searchMethod (CLASS_REGISTRY , Modifier .PUBLIC , "getOptional" , Optional .class , CLASS_RESOURCE_LOCATION );
229236 static final @ Nullable MethodHandle REGISTRY_WRAP_AS_HOLDER = searchMethod (CLASS_REGISTRY , Modifier .PUBLIC , "wrapAsHolder" , CLASS_HOLDER , Object .class );
230237 static final @ Nullable MethodHandle SOUND_EVENT_CREATE_VARIABLE_RANGE = searchMethod (EntitySound .CLASS_SOUND_EVENT , Modifier .PUBLIC | Modifier .STATIC , "createVariableRangeEvent" , EntitySound .CLASS_SOUND_EVENT , CLASS_RESOURCE_LOCATION );
@@ -277,7 +284,6 @@ static final class Book_1_20_5 {
277284 static final MethodHandle CREATE_FILTERABLE = searchMethod (CLASS_MC_FILTERABLE , Modifier .PUBLIC | Modifier .STATIC , "passThrough" , CLASS_MC_FILTERABLE , Object .class );
278285 static final MethodHandle GET_REGISTRY = findStaticMethod (CLASS_CRAFT_REGISTRY , "getMinecraftRegistry" , CLASS_REGISTRY , CLASS_RESOURCE_KEY );
279286 static final MethodHandle CREATE_REGISTRY_KEY = searchMethod (CLASS_RESOURCE_KEY , Modifier .PUBLIC | Modifier .STATIC , "createRegistryKey" , CLASS_RESOURCE_KEY , CLASS_RESOURCE_LOCATION );
280- static final MethodHandle NEW_RESOURCE_LOCATION = findConstructor (CLASS_RESOURCE_LOCATION , String .class , String .class );
281287 static final MethodHandle NEW_BOOK_CONTENT = findConstructor (CLASS_MC_BOOK_CONTENT , CLASS_MC_FILTERABLE , String .class , Integer .TYPE , List .class , Boolean .TYPE );
282288 static final MethodHandle REGISTRY_GET_OPTIONAL = searchMethod (CLASS_REGISTRY , Modifier .PUBLIC , "getOptional" , Optional .class , CLASS_RESOURCE_LOCATION );
283289 static final Class <?> CLASS_ENUM_HAND = findClass (
0 commit comments