3232import pl .olafcio .avoid_impl .net .world .block_data .BlockDataNative ;
3333
3434import java .lang .annotation .Annotation ;
35+ import java .lang .reflect .AnnotatedElement ;
3536import java .util .Map ;
3637import java .util .Optional ;
3738import java .util .function .Function ;
@@ -51,19 +52,20 @@ public static BlockData create(Identification id) {
5152 return BlockDataNative .convertFrom (BuiltInRegistries .BLOCK .getValue (IdentificationNative .convert (id )).defaultBlockState ());
5253 }
5354
54- public static void register (Identification blockID , Supplier <? extends pl .olafcio .avoid .net .block .Block > constructor ) {
55+ public static void register (Identification blockID , Supplier <? extends pl .olafcio .avoid .net .block .Block > constructor , AnnotatedElement config ) {
5556 var id = IdentificationNative .convert (blockID );
5657
5758 Function <Properties , Block > callback = properties -> BlockNative .make (
5859 constructor .get (),
60+ config ,
5961 properties
6062 );
6163
6264 var inst = constructor .get ();
6365 var block = net .minecraft .world .level .block .Blocks .register (
6466 ResourceKey .create (Registries .BLOCK , id ),
6567 callback ,
66- getProperties (inst , inst . getClass () , blockID )
68+ getProperties (inst , config , blockID )
6769 ); //at:register
6870
6971 Registry .register (BuiltInRegistries .BLOCK_TYPE , id , simpleCodec (callback ));
@@ -102,7 +104,7 @@ public static void register(Identification blockID, Supplier<? extends pl.olafci
102104
103105 private record ChosenPreset (Properties properties , String preset ) {}
104106
105- private static <T extends pl .olafcio .avoid .net .block .Block > Properties getProperties (T instance , Class <? extends T > block , Identification blockID ) {
107+ private static <T extends pl .olafcio .avoid .net .block .Block > Properties getProperties (T instance , AnnotatedElement block , Identification blockID ) {
106108 var ret = presetProperties (block );
107109
108110 var properties = ret .properties ();
@@ -265,7 +267,7 @@ private static MapColor createMapColor(String colorName, int colorRGB) {
265267 }
266268
267269 @ NotNull
268- private static ChosenPreset presetProperties (Class <? extends pl . olafcio . avoid . net . block . Block > block ) {
270+ private static ChosenPreset presetProperties (AnnotatedElement block ) {
269271 var presets = Map .<Class <? extends Annotation >, Function <? extends Annotation , Properties >>
270272 //at:presets
271273 of (_presetNetherStem .class , (_presetNetherStem preset ) -> IBlocks .netherStemProperties (
@@ -297,7 +299,7 @@ private static ChosenPreset presetProperties(Class<? extends pl.olafcio.avoid.ne
297299 }
298300
299301 @ SuppressWarnings ("unchecked" )
300- private static <T extends Annotation > T getUnsafe (Class <?> clazz , Class <?> annotation ) {
302+ private static <T extends Annotation > T getUnsafe (AnnotatedElement clazz , Class <?> annotation ) {
301303 return clazz .getDeclaredAnnotation ((Class <T >) annotation );
302304 }
303305}
0 commit comments