fixed some blocks not dropping anything when broken

Adresses #277
This commit is contained in:
Ell 2022-09-30 15:14:10 +02:00
parent f11069764d
commit 13f3b75df6
2 changed files with 30 additions and 0 deletions

View file

@ -0,0 +1,15 @@
{
"values": [
"naturesaura:spring",
"naturesaura:aura_timer",
"naturesaura:animal_container",
"naturesaura:blast_furnace_booster",
"naturesaura:snow_creator",
"naturesaura:chorus_generator",
"naturesaura:nether_grass",
"naturesaura:gold_nether_brick",
"naturesaura:gold_brick",
"naturesaura:item_distributor",
"naturesaura:weather_changer"
]
}

View file

@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.data;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.blocks.ModBlocks;
import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.tags.BlockTagsProvider;
import net.minecraft.resources.ResourceLocation;
@ -9,6 +10,7 @@ import net.minecraft.tags.BlockTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.material.Material;
import net.minecraftforge.common.data.ExistingFileHelper;
import org.jetbrains.annotations.Nullable;
@ -38,5 +40,18 @@ public class BlockTagProvider extends BlockTagsProvider {
this.tag(BlockTagProvider.NETHER_ALTAR_WOOD).add(Blocks.CRIMSON_PLANKS, Blocks.WARPED_PLANKS);
this.tag(BlockTagProvider.NETHER_ALTAR_STONE).add(Blocks.NETHER_BRICKS);
for (var item : ModRegistry.ALL_ITEMS) {
if (!(item instanceof Block b))
continue;
var state = b.defaultBlockState();
if (!state.requiresCorrectToolForDrops())
continue;
var material = state.getMaterial();
if (material == Material.STONE) {
this.tag(BlockTags.MINEABLE_WITH_PICKAXE).add(b);
} else if (material == Material.WOOD) {
this.tag(BlockTags.MINEABLE_WITH_AXE).add(b);
}
}
}
}