-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
axes,hoes,swords,shovels,pickaxes,food,bricks
- Loading branch information
1 parent
b053610
commit 3fc7235
Showing
5 changed files
with
88 additions
and
10 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
src/main/java/org/auioc/mcmod/arnicalib/game/tag/HItemTags.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.auioc.mcmod.arnicalib.game.tag; | ||
|
||
import org.auioc.mcmod.arnicalib.ArnicaLib; | ||
import net.minecraft.tags.TagKey; | ||
import net.minecraft.world.item.Item; | ||
|
||
public class HItemTags { | ||
|
||
public static final TagKey<Item> AXES = create("axes"); | ||
public static final TagKey<Item> HOES = create("hoes"); | ||
public static final TagKey<Item> SWORDS = create("swords"); | ||
public static final TagKey<Item> SHOVELS = create("shovels"); | ||
public static final TagKey<Item> PICKAXES = create("pickaxes"); | ||
|
||
public static final TagKey<Item> FOOD = create("food"); | ||
public static final TagKey<Item> FOOD_MEAT = create("food/meat"); | ||
public static final TagKey<Item> FOOD_FAST = create("food/fast"); | ||
public static final TagKey<Item> FOOD_ALWAYS_EDIBLE = create("food/always_edible"); | ||
|
||
public static final TagKey<Item> BRICKS = create("bricks"); | ||
|
||
// ====================================================================== // | ||
|
||
public static void init() {} | ||
|
||
public static TagKey<Item> create(String _path) { | ||
return TagCreator.item(ArnicaLib.id(_path)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/main/java/org/auioc/mcmod/arnicalib/mod/datagen/provider/HItemTagsProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.auioc.mcmod.arnicalib.mod.datagen.provider; | ||
|
||
import static org.auioc.mcmod.arnicalib.game.tag.HItemTags.*; | ||
import org.auioc.mcmod.arnicalib.ArnicaLib; | ||
import org.auioc.mcmod.arnicalib.game.datagen.tag.IHTagsProvider; | ||
import net.minecraft.data.DataGenerator; | ||
import net.minecraft.data.tags.BlockTagsProvider; | ||
import net.minecraft.data.tags.ItemTagsProvider; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.item.Items; | ||
import net.minecraftforge.common.data.ExistingFileHelper; | ||
import net.minecraftforge.registries.ForgeRegistries; | ||
import net.minecraftforge.registries.IForgeRegistry; | ||
|
||
public class HItemTagsProvider extends ItemTagsProvider implements IHTagsProvider<Item> { | ||
|
||
public HItemTagsProvider(DataGenerator generator, BlockTagsProvider blockTags, ExistingFileHelper fileHelper) { | ||
super(generator, blockTags, ArnicaLib.MOD_ID, fileHelper); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "HItemsTags"; | ||
} | ||
|
||
@Override | ||
public IForgeRegistry<Item> getRegistry() { | ||
return ForgeRegistries.ITEMS; | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("deprecation") | ||
protected void addTags() { | ||
tag(BRICKS).add(Items.BRICK, Items.NETHER_BRICK); | ||
|
||
tag(AXES).add(Items.WOODEN_AXE, Items.STONE_AXE, Items.IRON_AXE, Items.GOLDEN_AXE, Items.DIAMOND_AXE, Items.NETHERITE_AXE); | ||
tag(HOES).add(Items.WOODEN_HOE, Items.STONE_HOE, Items.IRON_HOE, Items.GOLDEN_HOE, Items.DIAMOND_HOE, Items.NETHERITE_HOE); | ||
tag(SWORDS).add(Items.WOODEN_SWORD, Items.STONE_SWORD, Items.IRON_SWORD, Items.GOLDEN_SWORD, Items.DIAMOND_SWORD, Items.NETHERITE_SWORD); | ||
tag(SHOVELS).add(Items.WOODEN_SHOVEL, Items.STONE_SHOVEL, Items.IRON_SHOVEL, Items.GOLDEN_SHOVEL, Items.DIAMOND_SHOVEL, Items.NETHERITE_SHOVEL); | ||
tag(PICKAXES).add(Items.WOODEN_PICKAXE, Items.STONE_PICKAXE, Items.IRON_PICKAXE, Items.GOLDEN_PICKAXE, Items.DIAMOND_PICKAXE, Items.NETHERITE_PICKAXE); | ||
|
||
addFromRegistry(tag(FOOD), (item) -> item.isEdible()); | ||
addFromRegistry(tag(FOOD_MEAT), (item) -> item.isEdible() && item.getFoodProperties().isMeat()); | ||
addFromRegistry(tag(FOOD_FAST), (item) -> item.isEdible() && item.getFoodProperties().isFastFood()); | ||
addFromRegistry(tag(FOOD_ALWAYS_EDIBLE), (item) -> item.isEdible() && item.getFoodProperties().canAlwaysEat()); | ||
} | ||
|
||
} |