datagenerate block models for particle-only tesrs

This commit is contained in:
Vincent Lee committed 2020-07-01 23:16:24 -05:00
1 parent 0dff00c506
commit 88e3d8ffc0
63 files changed
+217 -188

No files matched your search

@@ -1,7 +1,7 @@
{
"variants": {
"": {
"model": "minecraft:block/soul_sand"
"model": "botania:block/gaia_head"
}
}
}
@@ -1,7 +1,7 @@
{
"variants": {
"": {
"model": "minecraft:block/soul_sand"
"model": "botania:block/gaia_wall_head"
}
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/redstone_torch"
}
}
@@ -1,5 +1,5 @@
{
"textures": {
"particle": "botania:block/livingwood"
}
}
{
"textures": {
"particle": "botania:block/livingwood"
}
}
@@ -1,5 +1,5 @@
{
"textures": {
"particle": "botania:block/livingwood"
}
}
{
"textures": {
"particle": "botania:block/livingwood"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/black_wool"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/blue_wool"
}
}
@@ -1,5 +1,5 @@
{
"textures": {
"particle": "botania:block/livingrock"
}
}
{
"textures": {
"particle": "botania:block/livingrock"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/brown_wool"
}
}
@@ -1,5 +1,5 @@
{
"textures": {
"particle": "botania:block/elementium_block"
}
}
{
"textures": {
"particle": "botania:block/elementium_block"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/cyan_wool"
}
}
@@ -1,5 +1,5 @@
{
"textures": {
"particle": "botania:block/luminizer_detector"
}
}
{
"textures": {
"particle": "botania:block/luminizer_detector"
}
}
@@ -0,0 +1 @@
{}
@@ -1,5 +1,5 @@
{
"textures": {
"particle": "botania:block/luminizer_fork"
}
}
{
"textures": {
"particle": "botania:block/luminizer_fork"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/soul_sand"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "botania:block/elementium_block"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/soul_sand"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/gray_wool"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/green_wool"
}
}
@@ -1,5 +1,5 @@
{
"textures": {
"particle": "botania:block/mana_glass"
}
}
{
"textures": {
"particle": "botania:block/mana_glass"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/light_blue_wool"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/light_gray_wool"
}
}
@@ -1,5 +1,5 @@
{
"textures": {
"particle": "botania:block/luminizer"
}
}
{
"textures": {
"particle": "botania:block/luminizer"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/lime_wool"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/magenta_wool"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/fire_0"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "botania:block/manasteel_block"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "botania:block/terrasteel_block"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/orange_wool"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/pink_wool"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/purple_wool"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/red_wool"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/white_wool"
}
}
@@ -1,5 +1,5 @@
{
"textures": {
"particle": "botania:block/luminizer_toggle"
}
}
{
"textures": {
"particle": "botania:block/luminizer_toggle"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/white_wool"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "block/yellow_wool"
}
}
@@ -30,7 +30,7 @@ public class BlockBuriedPetals extends BushBlock implements IGrowable {
private static final VoxelShape SHAPE = makeCuboidShape(0, 0, 0, 16, 1.6, 16);
private final DyeColor color;
public final DyeColor color;
public BlockBuriedPetals(DyeColor color, Properties builder) {
super(builder);
@@ -12,6 +12,7 @@ import com.google.common.collect.ImmutableMap;
import net.minecraft.block.*;
import net.minecraft.data.DataGenerator;
import net.minecraft.item.DyeColor;
import net.minecraft.state.EnumProperty;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.state.properties.DoubleBlockHalf;
@@ -26,9 +27,9 @@ import net.minecraftforge.client.model.generators.ModelFile;
import net.minecraftforge.client.model.generators.MultiPartBlockStateBuilder;
import vazkii.botania.common.block.*;
import vazkii.botania.common.block.decor.BlockBuriedPetals;
import vazkii.botania.common.block.decor.BlockModMushroom;
import vazkii.botania.common.block.decor.BlockPetalBlock;
import vazkii.botania.common.block.decor.BlockShinyFlower;
import vazkii.botania.common.block.string.BlockRedString;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibMisc;
@@ -40,6 +41,7 @@ import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import static vazkii.botania.common.block.ModBlocks.*;
import static vazkii.botania.common.lib.ResourceLocationHelper.prefix;
public class BlockstateProvider extends BlockStateProvider {
@@ -59,22 +61,46 @@ public class BlockstateProvider extends BlockStateProvider {
.filter(b -> LibMisc.MOD_ID.equals(Registry.BLOCK.getKey(b).getNamespace()))
.collect(Collectors.toSet());
// Manually written blockstates + models
blocks.remove(ModBlocks.craftCrate);
blocks.remove(ModBlocks.ghostRail);
blocks.remove(ModBlocks.solidVines);
blocks.remove(craftCrate);
blocks.remove(ghostRail);
blocks.remove(solidVines);
// Single blocks
String elfGlassName = Registry.BLOCK.getKey(ModBlocks.elfGlass).getPath();
String elfGlassName = Registry.BLOCK.getKey(elfGlass).getPath();
ConfiguredModel[] elfGlassFiles = IntStream.rangeClosed(0, 3)
.mapToObj(i -> models().getExistingFile(prefix("block/" + elfGlassName + "_" + i)))
.map(ConfiguredModel::new).toArray(ConfiguredModel[]::new);
getVariantBuilder(ModBlocks.elfGlass).partialState().setModels(elfGlassFiles);
blocks.remove(ModBlocks.elfGlass);
getVariantBuilder(elfGlass).partialState().setModels(elfGlassFiles);
blocks.remove(elfGlass);
String plateName = Registry.BLOCK.getKey(ModBlocks.incensePlate).getPath();
ModelFile plateFile = models().getExistingFile(prefix("block/" + plateName));
horizontalBlock(ModBlocks.incensePlate, plateFile, 0);
blocks.remove(ModBlocks.incensePlate);
horizontalBlock(incensePlate, plateFile, 0);
blocks.remove(incensePlate);
// TESRs with only particles
particleOnly(animatedTorch, new ResourceLocation("block/redstone_torch"));
particleOnly(avatar, prefix("block/livingwood"));
particleOnly(bellows, prefix("block/livingwood"));
particleOnly(brewery, prefix("block/livingrock"));
particleOnly(corporeaIndex, prefix("block/elementium_block"));
particleOnly(lightRelayDetector, prefix("block/luminizer_detector"));
simpleBlock(fakeAir, models().getBuilder(Registry.BLOCK.getKey(ModBlocks.fakeAir).getPath()));
particleOnly(lightRelayFork, prefix("block/luminizer_fork"));
particleOnly(gaiaHead, new ResourceLocation("block/soul_sand"));
particleOnly(gaiaHeadWall, new ResourceLocation("block/soul_sand"));
particleOnly(gaiaPylon, prefix("block/elementium_block"));
particleOnly(hourglass, prefix("block/mana_glass"));
particleOnly(lightRelayDefault, prefix("block/luminizer"));
particleOnly(manaFlame, new ResourceLocation("block/fire_0"));
particleOnly(manaPylon, prefix("block/manasteel_block"));
particleOnly(naturaPylon, prefix("block/terrasteel_block"));
particleOnly(teruTeruBozu, new ResourceLocation("block/white_wool"));
particleOnly(lightRelayToggle, prefix("block/luminizer_toggle"));
blocks.removeAll(Arrays.asList(animatedTorch, avatar, bellows, brewery, corporeaIndex, lightRelayDetector,
fakeAir, lightRelayFork, gaiaHead, gaiaHeadWall, gaiaPylon, hourglass,
lightRelayDefault, manaFlame, manaPylon, naturaPylon, teruTeruBozu, lightRelayToggle));
// Block types
Predicate<Block> flowers = b -> b instanceof BlockSpecialFlower
@@ -87,11 +113,6 @@ public class BlockstateProvider extends BlockStateProvider {
simpleBlock(b, model);
});
takeAll(blocks, ModBlocks.gaiaHead, ModBlocks.gaiaHeadWall).forEach(b -> {
ModelFile file = models().getExistingFile(new ResourceLocation("block/soul_sand"));
getVariantBuilder(b).partialState().setModels(new ConfiguredModel(file));
});
takeAll(blocks, b -> b instanceof BlockAltGrass).forEach(b -> {
String name = Registry.BLOCK.getKey(b).getPath();
ResourceLocation side = prefix("block/" + name + "_side");
@@ -114,6 +135,12 @@ public class BlockstateProvider extends BlockStateProvider {
.partialState().with(TallFlowerBlock.HALF, DoubleBlockHalf.UPPER).setModels(new ConfiguredModel(top));
});
takeAll(blocks, b -> b instanceof BlockBuriedPetals).forEach(b -> {
DyeColor color = ((BlockBuriedPetals) b).color;
ResourceLocation wool = new ResourceLocation("block/" + color.func_176610_l() + "_wool");
particleOnly(b, wool);
});
blocks.forEach(b -> {
String name = Registry.BLOCK.getKey(b).getPath();
if (name.contains("quartz") && b instanceof RotatedPillarBlock) {
@@ -173,6 +200,13 @@ public class BlockstateProvider extends BlockStateProvider {
});
}
private void particleOnly(Block b, ResourceLocation particle) {
String name = Registry.BLOCK.getKey(b).getPath();
ModelFile f = models().getBuilder(name)
.texture("particle", particle);
simpleBlock(b, f);
}
@SafeVarargs
private static <T> Iterable<T> takeAll(Set<T> src, T... items) {
List<T> ret = Arrays.asList(items);
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:block/redstone_torch"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:block/black_wool"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:block/blue_wool"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:block/brown_wool"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:block/cyan_wool"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:item/barrier"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:block/soul_sand"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "botania:model/pylon_gaia"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:block/gray_wool"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:block/green_wool"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:block/light_blue_wool"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:block/light_gray_wool"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:block/lime_wool"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:block/magenta_wool"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:block/fire_0"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "botania:model/pylon_mana"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "botania:model/pylon_natura"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:block/orange_wool"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:block/pink_wool"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:block/purple_wool"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:block/red_wool"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:block/white_wool"
}
}
@@ -1,6 +0,0 @@
{
"parent": "botania:block/shapes/fifteen_high_all",
"textures": {
"all": "botania:block/dirtpath"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:block/white_wool"
}
}
@@ -1,5 +0,0 @@
{
"textures": {
"particle": "minecraft:block/yellow_wool"
}
}