added tools to their respective tags

closes #312
This commit is contained in:
Ell 2023-06-27 11:04:11 +02:00
parent f87ef01caa
commit 856f01b7ca
7 changed files with 58 additions and 3 deletions

View file

@ -0,0 +1,7 @@
{
"values": [
"naturesaura:depth_axe",
"naturesaura:infused_iron_axe",
"naturesaura:sky_axe"
]
}

View file

@ -0,0 +1,7 @@
{
"values": [
"naturesaura:depth_hoe",
"naturesaura:infused_iron_hoe",
"naturesaura:sky_hoe"
]
}

View file

@ -0,0 +1,7 @@
{
"values": [
"naturesaura:depth_pickaxe",
"naturesaura:infused_iron_pickaxe",
"naturesaura:sky_pickaxe"
]
}

View file

@ -0,0 +1,7 @@
{
"values": [
"naturesaura:depth_shovel",
"naturesaura:infused_iron_shovel",
"naturesaura:sky_shovel"
]
}

View file

@ -0,0 +1,7 @@
{
"values": [
"naturesaura:depth_sword",
"naturesaura:infused_iron_sword",
"naturesaura:sky_sword"
]
}

View file

@ -1,7 +1,7 @@
{
"values": [
"naturesaura:depth_pickaxe",
"naturesaura:infused_iron_pickaxe",
"naturesaura:sky_pickaxe",
"naturesaura:depth_pickaxe"
"naturesaura:sky_pickaxe"
]
}

View file

@ -3,6 +3,9 @@ package de.ellpeck.naturesaura.data;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.compat.Compat;
import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.items.tools.*;
import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.tags.BlockTagsProvider;
import net.minecraft.data.tags.ItemTagsProvider;
@ -13,6 +16,8 @@ import net.minecraft.world.item.Item;
import net.minecraftforge.common.Tags;
import net.minecraftforge.common.data.ExistingFileHelper;
import java.util.Comparator;
public class ItemTagProvider extends ItemTagsProvider {
public ItemTagProvider(DataGenerator generatorIn, BlockTagsProvider blockTagProvider, ExistingFileHelper helper) {
@ -29,7 +34,22 @@ public class ItemTagProvider extends ItemTagsProvider {
this.copy(BlockTags.SLABS, ItemTags.SLABS);
this.tag(Tags.Items.RODS_WOODEN).add(ModItems.ANCIENT_STICK);
this.tag(ItemTags.CLUSTER_MAX_HARVESTABLES).add(ModItems.INFUSED_IRON_PICKAXE, ModItems.SKY_PICKAXE, ModItems.DEPTH_PICKAXE);
// 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 Item).map(i -> (Item) i).forEach(i -> {
if (i instanceof ItemPickaxe) {
this.tag(ItemTags.CLUSTER_MAX_HARVESTABLES).add(i);
this.tag(Tags.Items.TOOLS_PICKAXES).add(i);
} else if (i instanceof ItemAxe) {
this.tag(Tags.Items.TOOLS_AXES).add(i);
} else if (i instanceof ItemHoe) {
this.tag(Tags.Items.TOOLS_HOES).add(i);
} else if (i instanceof ItemSword) {
this.tag(Tags.Items.TOOLS_SWORDS).add(i);
} else if (i instanceof ItemShovel) {
this.tag(Tags.Items.TOOLS_SHOVELS).add(i);
}
});
Compat.addItemTags(this);
}