2020-01-29 00:40:28 +01:00
|
|
|
package de.ellpeck.naturesaura.data;
|
2020-01-23 16:05:52 +01:00
|
|
|
|
2021-01-14 23:03:09 +01:00
|
|
|
import de.ellpeck.naturesaura.NaturesAura;
|
2020-01-23 16:05:52 +01:00
|
|
|
import de.ellpeck.naturesaura.blocks.ModBlocks;
|
2023-02-17 11:10:06 +01:00
|
|
|
import de.ellpeck.naturesaura.reg.IModItem;
|
2022-09-30 15:14:10 +02:00
|
|
|
import de.ellpeck.naturesaura.reg.ModRegistry;
|
2020-01-23 16:05:52 +01:00
|
|
|
import net.minecraft.data.DataGenerator;
|
2021-12-15 16:24:53 +01:00
|
|
|
import net.minecraft.data.tags.BlockTagsProvider;
|
|
|
|
import net.minecraft.resources.ResourceLocation;
|
2020-01-23 16:05:52 +01:00
|
|
|
import net.minecraft.tags.BlockTags;
|
2022-03-04 15:59:04 +01:00
|
|
|
import net.minecraft.tags.TagKey;
|
2021-12-15 16:24:53 +01:00
|
|
|
import net.minecraft.world.level.block.Block;
|
|
|
|
import net.minecraft.world.level.block.Blocks;
|
2022-09-30 15:14:10 +02:00
|
|
|
import net.minecraft.world.level.material.Material;
|
2021-12-16 21:56:27 +01:00
|
|
|
import net.minecraftforge.common.data.ExistingFileHelper;
|
|
|
|
import org.jetbrains.annotations.Nullable;
|
2020-01-23 16:05:52 +01:00
|
|
|
|
2023-02-17 11:10:06 +01:00
|
|
|
import java.util.Comparator;
|
|
|
|
|
2020-01-23 16:05:52 +01:00
|
|
|
public class BlockTagProvider extends BlockTagsProvider {
|
2021-01-14 23:03:09 +01:00
|
|
|
|
2022-06-01 16:00:55 +02:00
|
|
|
public static final TagKey<Block> ALTAR_WOOD = BlockTags.create(new ResourceLocation(NaturesAura.MOD_ID, "altar_wood"));
|
|
|
|
public static final TagKey<Block> ALTAR_STONE = BlockTags.create(new ResourceLocation(NaturesAura.MOD_ID, "altar_stone"));
|
2023-02-15 22:59:14 +01:00
|
|
|
public static final TagKey<Block> ALTAR_GOLD_BRICK = BlockTags.create(new ResourceLocation(NaturesAura.MOD_ID, "altar_gold_brick"));
|
|
|
|
public static final TagKey<Block> ALTAR_FANCY_BRICK = BlockTags.create(new ResourceLocation(NaturesAura.MOD_ID, "altar_fancy_brick"));
|
2021-01-14 23:03:09 +01:00
|
|
|
|
2021-12-16 21:56:27 +01:00
|
|
|
public BlockTagProvider(DataGenerator gen, @Nullable ExistingFileHelper existingFileHelper) {
|
|
|
|
super(gen, NaturesAura.MOD_ID, existingFileHelper);
|
2020-01-23 16:05:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-12-15 16:24:53 +01:00
|
|
|
protected void addTags() {
|
|
|
|
this.tag(BlockTags.LOGS).add(ModBlocks.ANCIENT_LOG, ModBlocks.ANCIENT_BARK);
|
|
|
|
this.tag(BlockTags.PLANKS).add(ModBlocks.ANCIENT_PLANKS);
|
|
|
|
this.tag(BlockTags.STAIRS).add(ModBlocks.ANCIENT_STAIRS, ModBlocks.INFUSED_BRICK_STAIRS, ModBlocks.INFUSED_STAIRS);
|
|
|
|
this.tag(BlockTags.LEAVES).add(ModBlocks.GOLDEN_LEAVES, ModBlocks.ANCIENT_LEAVES, ModBlocks.DECAYED_LEAVES);
|
|
|
|
this.tag(BlockTags.RAILS).add(ModBlocks.DIMENSION_RAIL_END, ModBlocks.DIMENSION_RAIL_NETHER, ModBlocks.DIMENSION_RAIL_OVERWORLD);
|
|
|
|
this.tag(BlockTags.SLABS).add(ModBlocks.ANCIENT_SLAB, ModBlocks.INFUSED_SLAB, ModBlocks.INFUSED_BRICK_SLAB);
|
2022-03-04 15:59:04 +01:00
|
|
|
this.tag(BlockTags.DIRT).add(ModBlocks.NETHER_GRASS);
|
2021-12-15 16:24:53 +01:00
|
|
|
this.tag(BlockTags.SMALL_FLOWERS).add(ModBlocks.END_FLOWER, ModBlocks.AURA_BLOOM);
|
2023-02-15 22:59:14 +01:00
|
|
|
this.tag(BlockTagProvider.ALTAR_WOOD).addTag(BlockTags.PLANKS).add(Blocks.CRIMSON_PLANKS, Blocks.WARPED_PLANKS);
|
|
|
|
this.tag(BlockTagProvider.ALTAR_STONE).addTag(BlockTags.STONE_BRICKS).add(Blocks.NETHER_BRICKS);
|
|
|
|
this.tag(BlockTagProvider.ALTAR_GOLD_BRICK).add(ModBlocks.GOLD_BRICK, ModBlocks.GOLD_NETHER_BRICK);
|
|
|
|
this.tag(BlockTagProvider.ALTAR_FANCY_BRICK).add(Blocks.RED_NETHER_BRICKS, Blocks.CHISELED_STONE_BRICKS);
|
2022-06-01 16:00:55 +02:00
|
|
|
|
2023-02-17 11:10:06 +01:00
|
|
|
// sort these so that they don't change the json every time we run data (because it's a set)
|
|
|
|
ModRegistry.ALL_ITEMS.stream().sorted(Comparator.comparing(IModItem::getBaseName)).filter(i -> i instanceof Block).map(i -> (Block) i).forEach(b -> {
|
2023-01-28 10:29:59 +01:00
|
|
|
var material = b.defaultBlockState().getMaterial();
|
|
|
|
if (material == Material.STONE || material == Material.METAL) {
|
2022-09-30 15:14:10 +02:00
|
|
|
this.tag(BlockTags.MINEABLE_WITH_PICKAXE).add(b);
|
|
|
|
} else if (material == Material.WOOD) {
|
|
|
|
this.tag(BlockTags.MINEABLE_WITH_AXE).add(b);
|
|
|
|
}
|
2023-02-17 11:10:06 +01:00
|
|
|
});
|
2020-01-23 16:05:52 +01:00
|
|
|
}
|
|
|
|
}
|