Skip to content

Commit

Permalink
Merge branch 'Gu-ZT:releases/1.20.1' into releases/anvil_animation
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhuRuoLing authored Apr 18, 2024
2 parents 46fc6cd + 5f70513 commit d4a71e8
Show file tree
Hide file tree
Showing 51 changed files with 841 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ public static void init(RegistrateRecipeProvider provider) {
.setBlock(Blocks.LAVA_CAULDRON)
.unlockedBy(AnvilCraftDatagen.hasItem(ModItemTags.STONE), AnvilCraftDatagen.has(ModItemTags.STONE))
.save(provider, AnvilCraft.of("heating/" + BuiltInRegistries.BLOCK.getKey(Blocks.LAVA).getPath()));
AnvilRecipe.Builder.create(RecipeCategory.MISC)
.icon(Items.LAVA_BUCKET)
.hasBlock(ModBlocks.HEATER.get(), new Vec3(0.0, -2.0, 0.0), Map.entry(HeaterBlock.LIT, true))
.hasBlock(Blocks.CAULDRON)
.hasItemIngredient(new Vec3(0.0, -1.0, 0.0), 1, ModItemTags.STONE_FORGE)
.setBlock(Blocks.LAVA_CAULDRON)
.unlockedBy(AnvilCraftDatagen.hasItem(ModItemTags.STONE_FORGE),
AnvilCraftDatagen.has(ModItemTags.STONE_FORGE))
.save(provider, AnvilCraft
.of("heating/" + BuiltInRegistries.BLOCK.getKey(Blocks.LAVA).getPath()) + "_forge");
AnvilRecipe.Builder.create(RecipeCategory.MISC)
.icon(ModItems.ROYAL_STEEL_INGOT)
.hasBlock(ModBlocks.HEATER.get(), new Vec3(0.0, -2.0, 0.0), Map.entry(HeaterBlock.LIT, true))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,19 @@ public static void init(RegistrateRecipeProvider provider) {
.unlockedBy(AnvilCraftDatagen.hasItem(ModItems.DOUGH.get()), AnvilCraftDatagen.has(ModItems.DOUGH))
.save(provider, AnvilCraft.of("generic_cooking_bread"));

SimpleCookingRecipeBuilder.campfireCooking(Ingredient.of(ModItemTags.DOUGH_FORGE), RecipeCategory.FOOD,
Items.BREAD, 0.35f, 600)
.unlockedBy(AnvilCraftDatagen.hasItem(ModItems.DOUGH.get()), AnvilCraftDatagen.has(ModItems.DOUGH))
.save(provider, AnvilCraft.of("campfire_cooking_bread_forge"));
SimpleCookingRecipeBuilder.smoking(Ingredient.of(ModItemTags.DOUGH_FORGE), RecipeCategory.FOOD,
Items.BREAD, 0.35f, 100)
.unlockedBy(AnvilCraftDatagen.hasItem(ModItems.DOUGH.get()), AnvilCraftDatagen.has(ModItems.DOUGH))
.save(provider, AnvilCraft.of("smoking_bread_forge"));
SimpleCookingRecipeBuilder.generic(Ingredient.of(ModItemTags.DOUGH_FORGE), RecipeCategory.FOOD,
Items.BREAD, 0.35f, 600, RecipeSerializer.SMOKING_RECIPE)
.unlockedBy(AnvilCraftDatagen.hasItem(ModItems.DOUGH.get()), AnvilCraftDatagen.has(ModItems.DOUGH))
.save(provider, AnvilCraft.of("generic_cooking_bread_forge"));

VanillaRecipeProvider.stonecutterResultFromBase(provider, RecipeCategory.BUILDING_BLOCKS,
ModBlocks.CUT_ROYAL_STEEL_STAIRS, ModBlocks.CUT_ROYAL_STEEL_BLOCK);
VanillaRecipeProvider.stonecutterResultFromBase(provider, RecipeCategory.BUILDING_BLOCKS,
Expand Down
33 changes: 23 additions & 10 deletions common/src/main/java/dev/dubhe/anvilcraft/init/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import dev.dubhe.anvilcraft.block.StampingPlatformBlock;
import dev.dubhe.anvilcraft.data.generator.AnvilCraftDatagen;
import dev.dubhe.anvilcraft.item.CursedBlockItem;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.data.recipes.ShapedRecipeBuilder;
import net.minecraft.tags.BlockTags;
Expand Down Expand Up @@ -47,16 +48,28 @@ public class ModBlocks {
.simpleItem()
.defaultLoot()
.tag(BlockTags.MINEABLE_WITH_PICKAXE)
.recipe((ctx, provider) -> ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, ctx.get())
.pattern("BAB")
.pattern("B B")
.pattern("B B")
.define('A', ModItemTags.IRON_PLATES)
.define('B', Items.IRON_INGOT)
.unlockedBy("has_" + ModItemTags.IRON_PLATES.location().getPath(),
AnvilCraftDatagen.has(ModItemTags.IRON_PLATES))
.unlockedBy(AnvilCraftDatagen.hasItem(Items.IRON_INGOT), AnvilCraftDatagen.has(Items.IRON_INGOT))
.save(provider))
.recipe((ctx, provider) -> {
ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, ctx.get())
.pattern("BAB")
.pattern("B B")
.pattern("B B")
.define('A', ModItemTags.IRON_PLATES)
.define('B', Items.IRON_INGOT)
.unlockedBy("has_" + ModItemTags.IRON_PLATES.location().getPath(),
AnvilCraftDatagen.has(ModItemTags.IRON_PLATES))
.unlockedBy(AnvilCraftDatagen.hasItem(Items.IRON_INGOT), AnvilCraftDatagen.has(Items.IRON_INGOT))
.save(provider);
ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, ctx.get())
.pattern("BAB")
.pattern("B B")
.pattern("B B")
.define('A', ModItemTags.IRON_PLATES_FORGE)
.define('B', Items.IRON_INGOT)
.unlockedBy("has_" + ModItemTags.IRON_PLATES_FORGE.location().getPath(),
AnvilCraftDatagen.has(ModItemTags.IRON_PLATES_FORGE))
.unlockedBy(AnvilCraftDatagen.hasItem(Items.IRON_INGOT), AnvilCraftDatagen.has(Items.IRON_INGOT))
.save(provider, BuiltInRegistries.ITEM.getKey(ctx.get().asItem()) + "_forge");
})
.register();
public static final BlockEntry<? extends Block> CORRUPTED_BEACON = REGISTRATE
.block("corrupted_beacon", CorruptedBeaconBlock::new)
Expand Down
22 changes: 21 additions & 1 deletion common/src/main/java/dev/dubhe/anvilcraft/init/ModItemTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,35 @@ public class ModItemTags {
public static final TagKey<Item> PLATES = bindC("plates");
public static final TagKey<Item> GOLD_PLATES = bindC("gold_plates");
public static final TagKey<Item> IRON_PLATES = bindC("iron_plates");
public static final TagKey<Item> STONE = bindC("stone");

public static final TagKey<Item> FLOUR_FORGE = bindForge("flour");
public static final TagKey<Item> WHEAT_FLOUR_FORGE = bindForge("flour/wheat");
public static final TagKey<Item> DOUGH_FORGE = bindForge("dough");
public static final TagKey<Item> WHEAT_DOUGH_FORGE = bindForge("dough/wheat");
public static final TagKey<Item> PICKAXES_FORGE = bindForge("pickaxes");
public static final TagKey<Item> AXES_FORGE = bindForge("axes");
public static final TagKey<Item> HOES_FORGE = bindForge("hoes");
public static final TagKey<Item> SHOVELS_FORGE = bindForge("shovels");
public static final TagKey<Item> SWORDS_FORGE = bindForge("swords");
public static final TagKey<Item> FOODS_FORGE = bindForge("foods");
public static final TagKey<Item> PLATES_FORGE = bindForge("plates");
public static final TagKey<Item> GOLD_PLATES_FORGE = bindForge("gold_plates");
public static final TagKey<Item> IRON_PLATES_FORGE = bindForge("iron_plates");
public static final TagKey<Item> STONE_FORGE = bindForge("stone");

public static final TagKey<Item> ROYAL_STEEL_PICKAXE_BASE = bind("royal_steel_pickaxe_base");
public static final TagKey<Item> CAPACITOR = bind("capacitor");
public static final TagKey<Item> STONE = bindC("stone");


private static @NotNull TagKey<Item> bindC(String id) {
return TagKey.create(Registries.ITEM, new ResourceLocation("c", id));
}

private static @NotNull TagKey<Item> bindForge(String id) {
return TagKey.create(Registries.ITEM, new ResourceLocation("forge", id));
}

private static @NotNull TagKey<Item> bind(String id) {
return TagKey.create(Registries.ITEM, AnvilCraft.of(id));
}
Expand Down
9 changes: 8 additions & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,15 @@ tasks.register('dataCopy', Copy) {
into forge_project.file('src/generated')
}

tasks.register('copyForgeData', Copy) {
group 'loom'
from project.file('src/generated/resources/data/c')
into project.file('src/generated/resources/data/forge')
}

dataCopy.dependsOn(dataDelete)
dataDelete.dependsOn(runDataCommon)
dataDelete.dependsOn(copyForgeData)
copyForgeData.dependsOn(runDataCommon)

sourcesJar {
def commonSources = common_project.sourcesJar
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_dough": {
"conditions": {
"items": [
{
"items": [
"anvilcraft:dough"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "anvilcraft:campfire_cooking_bread_forge"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_dough",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"anvilcraft:campfire_cooking_bread_forge"
]
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_dough": {
"conditions": {
"items": [
{
"items": [
"anvilcraft:dough"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "anvilcraft:generic_cooking_bread_forge"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_dough",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"anvilcraft:generic_cooking_bread_forge"
]
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_dough": {
"conditions": {
"items": [
{
"items": [
"anvilcraft:dough"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "anvilcraft:smoking_bread_forge"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_dough",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"anvilcraft:smoking_bread_forge"
]
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_stone": {
"conditions": {
"items": [
{
"tag": "forge:stone"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "anvilcraft:heating/lava_forge"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_stone",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"anvilcraft:heating/lava_forge"
]
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_iron_ingot": {
"conditions": {
"items": [
{
"items": [
"minecraft:iron_ingot"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_iron_plates": {
"conditions": {
"items": [
{
"tag": "forge:iron_plates"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "anvilcraft:stamping_platform_forge"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_iron_plates",
"has_iron_ingot",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"anvilcraft:stamping_platform_forge"
]
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"type": "minecraft:campfire_cooking",
"category": "food",
"cookingtime": 600,
"experience": 0.35,
"ingredient": {
"tag": "forge:dough"
},
"result": "minecraft:bread"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"type": "minecraft:smoking",
"category": "food",
"cookingtime": 600,
"experience": 0.35,
"ingredient": {
"tag": "forge:dough"
},
"result": "minecraft:bread"
}
Loading

0 comments on commit d4a71e8

Please sign in to comment.