-
Notifications
You must be signed in to change notification settings - Fork 18
/
InspirationsItemTagsProvider.java
90 lines (75 loc) · 4.02 KB
/
InspirationsItemTagsProvider.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package knightminer.inspirations.common.datagen;
import knightminer.inspirations.Inspirations;
import knightminer.inspirations.building.InspirationsBuilding;
import knightminer.inspirations.library.InspirationsTags;
import knightminer.inspirations.recipes.InspirationsRecipes;
import knightminer.inspirations.recipes.data.VanillaEnum;
import knightminer.inspirations.shared.InspirationsShared;
import knightminer.inspirations.tools.InspirationsTools;
import knightminer.inspirations.utility.InspirationsUtility;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.tags.BlockTagsProvider;
import net.minecraft.data.tags.ItemTagsProvider;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraftforge.common.Tags;
import net.minecraftforge.common.data.ExistingFileHelper;
public class InspirationsItemTagsProvider extends ItemTagsProvider {
public InspirationsItemTagsProvider(DataGenerator gen, ExistingFileHelper existing, BlockTagsProvider blocks) {
super(gen, blocks, Inspirations.modID, existing);
}
@Override
public String getName() {
return "Inspirations Item Tags";
}
@Override
protected void addTags() {
registerInspTags();
registerForgeTags();
registerVanillaTags();
}
private void registerInspTags() {
this.copy(InspirationsTags.Blocks.MULCH, InspirationsTags.Items.MULCH);
this.copy(BlockTags.SMALL_FLOWERS, ItemTags.SMALL_FLOWERS);
this.copy(InspirationsTags.Blocks.CARPETED_TRAPDOORS, InspirationsTags.Items.CARPETED_TRAPDOORS);
this.copy(InspirationsTags.Blocks.SHELVES, InspirationsTags.Items.BOOKSHELVES);
this.copy(InspirationsTags.Blocks.ENLIGHTENED_BUSHES, InspirationsTags.Items.ENLIGHTENED_BUSHES);
this.tag(ItemTags.DOORS).add(InspirationsBuilding.glassDoorItem);
this.copy(BlockTags.TRAPDOORS, ItemTags.TRAPDOORS);
TagAppender<Item> bookBuilder = this.tag(InspirationsTags.Items.FORGE_BOOKS)
.add(InspirationsBuilding.redstoneBook)
.add(Items.BOOK, Items.WRITABLE_BOOK, Items.WRITTEN_BOOK)
.add(Items.ENCHANTED_BOOK, Items.KNOWLEDGE_BOOK);
InspirationsBuilding.coloredBooks.values().forEach(bookBuilder::add);
this.tag(InspirationsTags.Items.BOOKS).addTag(InspirationsTags.Items.FORGE_BOOKS);
// item list of all relevant carpets
TagAppender<Item> carpetBuilder = this.tag(InspirationsTags.Items.CARPETS);
InspirationsShared.VANILLA_CARPETS.forEach(block -> carpetBuilder.add(block.asItem()));
// item list of all relevant shulker boxes
TagAppender<Item> shulkerBoxBuilder = this.tag(InspirationsTags.Items.SHULKER_BOXES);
shulkerBoxBuilder.add(Items.SHULKER_BOX);
VanillaEnum.SHULKER_BOX.forEach(block -> shulkerBoxBuilder.add(block.asItem()));
// relevant terracotta
TagAppender<Item> terracottaBuilder = this.tag(InspirationsTags.Items.TERRACOTTA);
terracottaBuilder.add(Items.TERRACOTTA);
VanillaEnum.TERRACOTTA.forEach(block -> terracottaBuilder.add(block.asItem()));
this.tag(InspirationsTags.Items.MILK_CONTAINERS).add(Items.BUCKET, Items.GLASS_BOTTLE);
}
private void registerForgeTags() {
this.tag(Tags.Items.BOOKSHELVES).addTag(InspirationsTags.Items.BOOKSHELVES);
this.tag(InspirationsTags.Items.SPLASH_BOTTLES).add(InspirationsRecipes.splashBottle);
this.tag(InspirationsTags.Items.LINGERING_BOTTLES).add(InspirationsRecipes.lingeringBottle);
// add dyed bottles to dye tag, forge tag are always INamedTag
InspirationsRecipes.simpleDyedWaterBottle.forEach((color, bottle) -> this.tag(color.getTag()).add(bottle));
}
private void registerVanillaTags() {
this.tag(ItemTags.ARROWS).add(InspirationsTools.redstoneArrow);
this.copy(BlockTags.LEAVES, ItemTags.LEAVES);
this.copy(BlockTags.WOODEN_TRAPDOORS, ItemTags.WOODEN_TRAPDOORS);
// Not copy(), we don't want to include the wall torch.
this.tag(ItemTags.PIGLIN_REPELLENTS).add(InspirationsUtility.soulLeverItem);
this.tag(ItemTags.PIGLIN_LOVED).add(InspirationsTools.redstoneCharger);
}
}