88import net .minecraft .world .level .block .Block ;
99import net .minecraft .world .level .block .CampfireBlock ;
1010import net .minecraft .world .level .block .SpreadingSnowyDirtBlock ;
11+ import net .minecraft .world .level .block .state .BlockState ;
12+ import net .minecraft .world .level .block .state .properties .Property ;
1113import net .neoforged .neoforge .client .model .generators .BlockModelBuilder ;
1214import net .neoforged .neoforge .client .model .generators .ConfiguredModel ;
1315import net .neoforged .neoforge .client .model .generators .ModelFile ;
1820import net .zepalesque .unity .block .natural .leaves .LeafPileBlock ;
1921import net .zepalesque .unity .block .state .UnityStates ;
2022
23+ import java .util .function .Function ;
24+
2125@ SuppressWarnings ("unused" )
2226public abstract class UnityBlockStateProvider extends AetherBlockStateProvider implements TextureExtensions {
2327
@@ -47,21 +51,21 @@ public void tintableShortGrass(AetherShortGrassBlock block, String location) {
4751 });
4852 }
4953
50- public void tintableGrassBlock (Block block , Block dirt , String location , String dirtLocation ) {
51- tintableGrassBlock (block , dirt , location , dirtLocation , (snow , bottom , top ) -> models ().cubeBottomTop (texture (block ).getNamespace () + ":" + name (block ) + "_snow" , snow , bottom , top ));
54+ public void tintableGrassBlock (Block block , Block dirt , String location , String dirtLocation , Property <?>... ignored ) {
55+ tintableGrassBlock (block , dirt , location , dirtLocation , (snow , bottom , top ) -> models ().cubeBottomTop (texture (block ).getNamespace () + ":" + name (block ) + "_snow" , snow , bottom , top ), ignored );
5256 }
5357
54- public void tintableGrassBlockOverride (Block block , Block dirt , String location , String dirtLocation ) {
55- tintableGrassBlock (block , dirt , location , dirtLocation , (snow , bottom , top ) -> models ().getExistingFile (texture (block , "" , "_snow" )));
58+ public void tintableGrassBlockOverride (Block block , Block dirt , String location , String dirtLocation , Property <?>... ignored ) {
59+ tintableGrassBlock (block , dirt , location , dirtLocation , (snow , bottom , top ) -> models ().getExistingFile (texture (block , "" , "_snow" )), ignored );
5660 }
5761
58- public void tintableGrassBlock (Block block , Block dirt , String location , String dirtLocation , SnowGrassModelMaker snowModel ) {
62+ public void tintableGrassBlock (Block block , Block dirt , String location , String dirtLocation , SnowGrassModelMaker snowModel , Property <?>... ignored ) {
5963 ResourceLocation bottom = texture (dirt , dirtLocation );
6064 ResourceLocation top = texture (block , location , "_top" );
6165 ResourceLocation overlay = texture (block , location , "_side_overlay" );
6266 ResourceLocation side = texture (block , location , "_side" );
6367 ResourceLocation snow = texture (block , location , "_side_snow" );
64- tintableGrassBlock (block , bottom , top , overlay , side , snowModel .create (snow , bottom , top ));
68+ tintableGrassBlock (block , bottom , top , overlay , side , snowModel .create (snow , bottom , top ), ignored );
6569 }
6670
6771 @ FunctionalInterface
@@ -73,18 +77,21 @@ public void tintableGrassBlock(Block block, ResourceLocation bottom,
7377 ResourceLocation top ,
7478 ResourceLocation overlay ,
7579 ResourceLocation side ,
76- ModelFile snowModel ) {
80+ ModelFile snowModel , Property <?>... ignored ) {
7781
7882 ModelFile model = models ().withExistingParent (texture (block ).getNamespace () + ":" + name (block ), Unity .loc (ModelProvider .BLOCK_FOLDER + "/template/tinted_grass_block" ))
7983 .texture ("overlay" , overlay )
8084 .texture ("side" , side )
8185 .texture ("top" , top )
8286 .texture ("bottom" , bottom )
8387 .texture ("particle" , bottom );
84- this . getVariantBuilder ( block ). forAllStates ( state -> {
88+ Function < BlockState , ConfiguredModel []> mapper = state -> {
8589 boolean isSnowy = state .getValue (SpreadingSnowyDirtBlock .SNOWY );
8690 return ConfiguredModel .allYRotations (isSnowy ? snowModel : model , 0 , false );
87- });
91+ };
92+
93+ if (ignored .length == 0 ) this .getVariantBuilder (block ).forAllStates (mapper );
94+ else this .getVariantBuilder (block ).forAllStatesExcept (mapper , ignored );
8895 }
8996
9097
0 commit comments