@@ -85,12 +85,20 @@ final class CraftBukkitAccess {
85
85
findMcClassName ("core.IRegistryWritable" ),
86
86
findMcClassName ("core.WritableRegistry" )
87
87
);
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
+ }
88
97
89
98
private CraftBukkitAccess () {
90
99
}
91
100
92
101
static final class Chat1_19_3 {
93
- static final @ Nullable MethodHandle NEW_RESOURCE_LOCATION = findConstructor (CLASS_RESOURCE_LOCATION , String .class , String .class );
94
102
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 );
95
103
static final @ Nullable MethodHandle SERVER_PLAYER_GET_LEVEL = searchMethod (CraftBukkitFacet .CRAFT_PLAYER_GET_HANDLE .type ().returnType (), Modifier .PUBLIC , "getLevel" , CLASS_SERVER_LEVEL );
96
104
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() {
224
232
225
233
static final class EntitySound_1_19_3 {
226
234
227
- static final @ Nullable MethodHandle NEW_RESOURCE_LOCATION = findConstructor (CLASS_RESOURCE_LOCATION , String .class , String .class );
228
235
static final @ Nullable MethodHandle REGISTRY_GET_OPTIONAL = searchMethod (CLASS_REGISTRY , Modifier .PUBLIC , "getOptional" , Optional .class , CLASS_RESOURCE_LOCATION );
229
236
static final @ Nullable MethodHandle REGISTRY_WRAP_AS_HOLDER = searchMethod (CLASS_REGISTRY , Modifier .PUBLIC , "wrapAsHolder" , CLASS_HOLDER , Object .class );
230
237
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 {
277
284
static final MethodHandle CREATE_FILTERABLE = searchMethod (CLASS_MC_FILTERABLE , Modifier .PUBLIC | Modifier .STATIC , "passThrough" , CLASS_MC_FILTERABLE , Object .class );
278
285
static final MethodHandle GET_REGISTRY = findStaticMethod (CLASS_CRAFT_REGISTRY , "getMinecraftRegistry" , CLASS_REGISTRY , CLASS_RESOURCE_KEY );
279
286
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 );
281
287
static final MethodHandle NEW_BOOK_CONTENT = findConstructor (CLASS_MC_BOOK_CONTENT , CLASS_MC_FILTERABLE , String .class , Integer .TYPE , List .class , Boolean .TYPE );
282
288
static final MethodHandle REGISTRY_GET_OPTIONAL = searchMethod (CLASS_REGISTRY , Modifier .PUBLIC , "getOptional" , Optional .class , CLASS_RESOURCE_LOCATION );
283
289
static final Class <?> CLASS_ENUM_HAND = findClass (
0 commit comments