Skip to content

Commit

Permalink
add grass-like blockstate generator
Browse files Browse the repository at this point in the history
  • Loading branch information
screret committed Dec 30, 2024
1 parent 8c28c15 commit 2095a43
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/main/java/argent_matter/gcyr/common/data/GCYRModels.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,28 @@ public static NonNullBiConsumer<DataGenContext<Block, Block>, RegistrateBlocksta
};
}

public static NonNullBiConsumer<DataGenContext<Block, Block>, RegistrateBlockstateProvider> grassBlockModel(String name,
ResourceLocation bottomTexture) {
return grassBlockModel(name,
GCYR.id("block/" + name + "_side"),
bottomTexture,
GCYR.id("block/" + name + "_top"));
}

public static NonNullBiConsumer<DataGenContext<Block, Block>, RegistrateBlockstateProvider> grassBlockModel(String name,
ResourceLocation sideTexture,
ResourceLocation bottomTexture,
ResourceLocation topTexture) {
return (ctx, prov) -> {
ModelFile base = prov.models().cubeBottomTop(name, sideTexture, bottomTexture, topTexture);
ConfiguredModel modelY0 = new ConfiguredModel(base, 0, 0, false);
ConfiguredModel modelY90 = new ConfiguredModel(base, 0, 90, false);
ConfiguredModel modelY180 = new ConfiguredModel(base, 0, 180, false);
ConfiguredModel modelY270 = new ConfiguredModel(base, 0, 270, false);
prov.getVariantBuilder(ctx.getEntry())
.partialState()
.setModels(modelY0, modelY90, modelY180, modelY270);
};
}

}

0 comments on commit 2095a43

Please sign in to comment.