-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
171 additions
and
2 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -110,6 +110,7 @@ gradle-app.setting | |
.gradletasknamecache | ||
|
||
**/build/ | ||
**/generated/ | ||
|
||
# Common working directory | ||
run/ | ||
|
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
5 changes: 5 additions & 0 deletions
5
src/main/generated/.cache/1810e4cc20b2b4f87aec0d12367377e3b7a8ed65
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,5 @@ | ||
// 1.20.1 2024-03-04T03:25:06.9109196 AnvilCraft/Tags for minecraft:item | ||
c2e0578add0db934d06b4790b09b1dea8bfe54d7 data\c\tags\items\flour.json | ||
57f11b39a3960a24a6460feffe1a5c8c9e8f3368 data\c\tags\items\dough.json | ||
57f11b39a3960a24a6460feffe1a5c8c9e8f3368 data\c\tags\items\dough\wheat.json | ||
c2e0578add0db934d06b4790b09b1dea8bfe54d7 data\c\tags\items\flour\wheat.json |
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,6 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"anvilcraft:dough" | ||
] | ||
} |
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,6 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"anvilcraft:dough" | ||
] | ||
} |
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,6 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"anvilcraft:flour" | ||
] | ||
} |
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,6 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"anvilcraft:flour" | ||
] | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/dev/dubhe/anvilcraft/data/AnvilCraftDataGenerator.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,12 @@ | ||
package dev.dubhe.anvilcraft.data; | ||
|
||
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; | ||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; | ||
|
||
public class AnvilCraftDataGenerator implements DataGeneratorEntrypoint { | ||
@Override | ||
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) { | ||
FabricDataGenerator.Pack pack = fabricDataGenerator.createPack(); | ||
pack.addProvider(MyItemTagGenerator::new); | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
src/main/java/dev/dubhe/anvilcraft/data/MyItemTagGenerator.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,62 @@ | ||
package dev.dubhe.anvilcraft.data; | ||
|
||
import dev.dubhe.anvilcraft.items.ModItemTags; | ||
import dev.dubhe.anvilcraft.items.ModItems; | ||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; | ||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; | ||
import net.minecraft.core.HolderLookup; | ||
import net.minecraft.core.registries.Registries; | ||
import net.minecraft.world.item.Item; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
public class MyItemTagGenerator extends FabricTagProvider<Item> { | ||
public MyItemTagGenerator(FabricDataOutput output, CompletableFuture<HolderLookup.Provider> registriesFuture) { | ||
super(output, Registries.ITEM, registriesFuture); | ||
} | ||
|
||
@Override | ||
protected void addTags(HolderLookup.Provider arg) { | ||
this.getOrCreateTagBuilder(ModItemTags.FLOUR).setReplace(false) | ||
.add(ModItems.FLOUR); | ||
this.getOrCreateTagBuilder(ModItemTags.WHEAT_FLOUR).setReplace(false) | ||
.add(ModItems.FLOUR); | ||
this.getOrCreateTagBuilder(ModItemTags.DOUGH).setReplace(false) | ||
.add(ModItems.DOUGH); | ||
this.getOrCreateTagBuilder(ModItemTags.WHEAT_DOUGH).setReplace(false) | ||
.add(ModItems.DOUGH); | ||
this.getOrCreateTagBuilder(ModItemTags.PICKAXES).setReplace(false) | ||
.add(ModItems.AMETHYST_PICKAXE) | ||
.add(ModItems.CHANGEABLE_PICKAXE_SILK_TOUCH) | ||
.add(ModItems.CHANGEABLE_PICKAXE_FORTUNE); | ||
this.getOrCreateTagBuilder(ModItemTags.AXES).setReplace(false) | ||
.add(ModItems.AMETHYST_AXE); | ||
this.getOrCreateTagBuilder(ModItemTags.HOES).setReplace(false) | ||
.add(ModItems.AMETHYST_HOE); | ||
this.getOrCreateTagBuilder(ModItemTags.SHOVELS).setReplace(false) | ||
.add(ModItems.AMETHYST_SHOVEL); | ||
this.getOrCreateTagBuilder(ModItemTags.SWORDS).setReplace(false) | ||
.add(ModItems.AMETHYST_SWORD); | ||
this.getOrCreateTagBuilder(ModItemTags.FOODS).setReplace(false) | ||
.add(ModItems.CHOCOLATE) | ||
.add(ModItems.CHOCOLATE_BLACK) | ||
.add(ModItems.CHOCOLATE_WHITE) | ||
.add(ModItems.CREAMY_BREAD_ROLL) | ||
.add(ModItems.MEATBALLS) | ||
.add(ModItems.DUMPLING) | ||
.add(ModItems.SHENGJIAN) | ||
.add(ModItems.SWEET_DUMPLING) | ||
.add(ModItems.BEEF_MUSHROOM_STEW); | ||
this.getOrCreateTagBuilder(ModItemTags.PROTOCOL).setReplace(false) | ||
.add(ModItems.PROTOCOL_ABSORB) | ||
.add(ModItems.PROTOCOL_PROTECT) | ||
.add(ModItems.PROTOCOL_RESTOCK) | ||
.add(ModItems.PROTOCOL_REPAIR); | ||
this.getOrCreateTagBuilder(ModItemTags.RAW_FOODS).setReplace(false) | ||
.add(ModItems.BEEF_MUSHROOM_STEW_RAW) | ||
.add(ModItems.DUMPLING_RAW) | ||
.add(ModItems.MEATBALLS_RAW) | ||
.add(ModItems.SWEET_DUMPLING_RAW) | ||
.add(ModItems.SHENGJIAN_RAW); | ||
} | ||
} |
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,31 @@ | ||
package dev.dubhe.anvilcraft.items; | ||
|
||
import dev.dubhe.anvilcraft.AnvilCraft; | ||
import net.minecraft.core.registries.Registries; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.tags.TagKey; | ||
import net.minecraft.world.item.Item; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class ModItemTags { | ||
public static final TagKey<Item> FLOUR = bindC("flour"); | ||
public static final TagKey<Item> WHEAT_FLOUR = bindC("flour/wheat"); | ||
public static final TagKey<Item> DOUGH = bindC("dough"); | ||
public static final TagKey<Item> WHEAT_DOUGH = bindC("dough/wheat"); | ||
public static final TagKey<Item> PICKAXES = bindC("pickaxes"); | ||
public static final TagKey<Item> AXES = bindC("axes"); | ||
public static final TagKey<Item> HOES = bindC("hoes"); | ||
public static final TagKey<Item> SHOVELS = bindC("shovels"); | ||
public static final TagKey<Item> SWORDS = bindC("swords"); | ||
public static final TagKey<Item> FOODS = bindC("foods"); | ||
public static final TagKey<Item> PROTOCOL = bind("protocol"); | ||
public static final TagKey<Item> RAW_FOODS = bind("raw_foods"); | ||
|
||
private static @NotNull TagKey<Item> bindC(String id) { | ||
return TagKey.create(Registries.ITEM, new ResourceLocation("c", id)); | ||
} | ||
|
||
private static @NotNull TagKey<Item> bind(String id) { | ||
return TagKey.create(Registries.ITEM, AnvilCraft.of(id)); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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