11package de .dafuqs .spectrum .registries ;
22
33import de .dafuqs .spectrum .*;
4+ import de .dafuqs .spectrum .data .*;
45import net .minecraft .core .registries .*;
56import net .minecraft .resources .*;
67import net .minecraft .tags .*;
910@ SuppressWarnings ("unused" )
1011public class SpectrumBlockTags {
1112
13+ private static final DeferredRegistrar .Contextual <DatagenProxy .ProvidedTagBuilderBuilder <Block >> REGISTRAR = new DeferredRegistrar .Contextual <>(DatagenProxy .IS_DATAGEN );
14+
1215 // PLANTS
1316 public static final TagKey <Block > AMARANTH_PLANTABLE = of ("amaranth_plantable" );
1417 public static final TagKey <Block > MERMAIDS_BRUSH_PLANTABLE = of ("mermaids_brush_plantable" );
@@ -80,22 +83,6 @@ public class SpectrumBlockTags {
8083 public static final TagKey <Block > MEMORY_VERY_FAST_MANIFESTERS = of ("memory_very_fast_manifesters" );
8184
8285 // CONVENTIONAL TAGS ("c" namespace)
83- public static final TagKey <Block > C_LIGHTNING_RODS = conventional ("lightning_rods" );
84- public static final TagKey <Block > C_BRUSHABLE_BLOCKS = conventional ("brushable_blocks" );
85- public static final TagKey <Block > C_INFESTED_BLOCKS = conventional ("infested_blocks" );
86-
87- private static TagKey <Block > of (String id ) {
88- return TagKey .create (Registries .BLOCK , SpectrumCommon .locate (id ));
89- }
90-
91- private static TagKey <Block > conventional (String id ) {
92- return TagKey .create (Registries .BLOCK , ResourceLocation .fromNamespaceAndPath ("c" , id ));
93- }
94-
95- // TODO: port datagen
96- /*
97- private static final DeferredRegister.Contextual<DatagenProxy.ProvidedTagBuilderBuilder<Block>> REGISTRAR = new DeferredRegistrar.Contextual<>(DatagenProxy.IS_DATAGEN);
98-
9986 public static final TagKey <Block > C_LIGHTNING_RODS = conventional ("lightning_rods" , provider -> provider
10087 .add (Blocks .LIGHTNING_ROD )
10188 .addOptionalTag (ResourceLocation .parse ("friendsandfoes:lightning_rods" )));
@@ -114,10 +101,23 @@ private static TagKey<Block> conventional(String id) {
114101 .add (Blocks .INFESTED_MOSSY_STONE_BRICKS )
115102 .add (Blocks .INFESTED_STONE_BRICKS )
116103 .add (SpectrumBlocks .INFESTED_BLACKSLAG ));
104+
105+ private static TagKey <Block > of (String id ) {
106+ return TagKey .create (Registries .BLOCK , SpectrumCommon .locate (id ));
107+ }
108+
109+ private static TagKey <Block > conventional (String id ) {
110+ return TagKey .create (Registries .BLOCK , ResourceLocation .fromNamespaceAndPath ("c" , id ));
111+ }
112+
113+ private static TagKey <Block > conventional (String id , DatagenProxy .TagBuilderCallback <Block > builder ) {
114+ TagKey <Block > tag = TagKey .create (Registries .BLOCK , ResourceLocation .fromNamespaceAndPath ("c" , id ));
115+ REGISTRAR .defer (ctx -> builder .build (ctx .build (tag )));
116+ return tag ;
117117 }
118118
119119 public static void provideTags (DatagenProxy .ProvidedTagBuilderBuilder <Block > provider ) {
120120 REGISTRAR .flush (provider );
121- }*/
121+ }
122122
123123}
0 commit comments