Skip to content

Commit

Permalink
Merge pull request #288 from wdfaESfaef/newItems
Browse files Browse the repository at this point in the history
添加新物品和配方
  • Loading branch information
Gugle2308 authored Apr 16, 2024
2 parents 04c3e1a + 73f2e29 commit 06f826e
Show file tree
Hide file tree
Showing 60 changed files with 2,216 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static void init(RegistrateRecipeProvider provider) {
.save(provider);
boil(ModItems.BEEF_MUSHROOM_STEW_RAW.get(), 1, ModItems.BEEF_MUSHROOM_STEW.get(), 1, provider);
cook(ModItems.UTUSAN_RAW.get(), 1, ModItems.UTUSAN.get(), 1, provider);
cook(ModItems.RESIN.get(), 1, ModItems.HARDEND_RESIN.get(), 1, provider);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import dev.dubhe.anvilcraft.init.ModItems;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraft.world.phys.Vec3;
Expand Down Expand Up @@ -62,6 +63,13 @@ public static void init(RegistrateRecipeProvider provider) {
.unlockedBy(AnvilCraftDatagen.hasItem(ModItems.PRISMARINE_CLUSTER.get()),
AnvilCraftDatagen.has(ModItems.PRISMARINE_CLUSTER))
.save(provider, AnvilCraft.of("stamping/geode_2_jewel"));
AnvilRecipe.Builder.create(RecipeCategory.MISC)
.hasBlock(ModBlocks.STAMPING_PLATFORM.get())
.hasItemIngredient(new Vec3(0.0, -0.75, 0.0), ItemTags.LOGS)
.spawnItem(new Vec3(0.0, -0.75, 0.0), ModItems.WOOD_FIBER, 2)
.spawnItem(new Vec3(0.0, -0.75, 0.0), 0.25, ModItems.RESIN)
.unlockedBy("hasitem", AnvilCraftDatagen.has(ItemTags.LOGS))
.save(provider, AnvilCraft.of("stamping/resin"));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
import dev.dubhe.anvilcraft.data.recipe.anvil.AnvilRecipe;
import dev.dubhe.anvilcraft.init.ModBlocks;
import dev.dubhe.anvilcraft.init.ModItems;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.LayeredCauldronBlock;
import net.minecraft.world.phys.Vec3;
Expand All @@ -15,20 +18,42 @@

public class TimeWarpRecipesLoader {
/**
* 时移配方
* 初始化时移配方
*
* @param provider 提供器
*/
public static void init(RegistrateRecipeProvider provider) {
timeWarpWithWater(ModItems.SEA_HEART_SHELL_SHARD.get(), ModItems.SEA_HEART_SHELL.get(), provider);
timeWarp(ModItems.RESIN.get(), ModItems.AMBER.get(), 1, provider);
timeWarp(ModBlocks.RESIN_BLOCK.asItem(), ModBlocks.AMBER_BLOCK.asItem(), 1, provider);
timeWarp(Items.OBSIDIAN, Items.CRYING_OBSIDIAN, 1, provider);
timeWarp(Items.CHARCOAL, Items.COAL, 1, provider);
timeWarp(Items.SAND, Items.DIRT, 1, provider);
timeWarp(Items.IRON_BLOCK, Items.RAW_IRON, 1, provider);
timeWarp(Items.GOLD_BLOCK, Items.RAW_GOLD, 1, provider);
timeWarp(Items.COPPER_BLOCK, Items.RAW_COPPER, 3, provider);
}

private static void timeWarp(Item item, Item item1, int count, RegistrateRecipeProvider provider) {
AnvilRecipe.Builder.create(RecipeCategory.MISC)
.icon(item1)
.hasBlock(ModBlocks.CORRUPTED_BEACON.get(), new Vec3(0.0, -2.0, 0.0))
.hasBlock(Blocks.CAULDRON)
.hasItemIngredient(new Vec3(0.0, -1.0, 0.0), item)
.spawnItem(new Vec3(0.0, -1.0, 0.0), item1, count)
.unlockedBy(AnvilCraftDatagen.hasItem(item), AnvilCraftDatagen.has(item))
.save(provider, AnvilCraft.of("timewarp/" + BuiltInRegistries.ITEM.getKey(item1).getPath()));
}

private static void timeWarpWithWater(Item item, Item item1, RegistrateRecipeProvider provider) {
AnvilRecipe.Builder.create(RecipeCategory.MISC)
.icon(ModItems.SEA_HEART_SHELL)
.hasBlock(ModBlocks.CORRUPTED_BEACON.get(), new Vec3(0.0, -2.0, 0.0))
.hasBlock(Blocks.WATER_CAULDRON, new Vec3(0.0, -1.0, 0.0), Map.entry(LayeredCauldronBlock.LEVEL, 3))
.hasItemIngredient(new Vec3(0.0, -1.0, 0.0), ModItems.SEA_HEART_SHELL_SHARD)
.spawnItem(new Vec3(0.0, -1.0, 0.0), ModItems.SEA_HEART_SHELL)
.setBlock(Blocks.CAULDRON.defaultBlockState())
.unlockedBy(AnvilCraftDatagen.hasItem(ModItems.SEA_HEART_SHELL_SHARD.get()),
AnvilCraftDatagen.has(ModItems.SEA_HEART_SHELL_SHARD))
.save(provider, AnvilCraft.of("timewarp/sea_heart_shell"));
.icon(item1)
.hasBlock(ModBlocks.CORRUPTED_BEACON.get(), new Vec3(0.0, -2.0, 0.0))
.hasBlock(Blocks.WATER_CAULDRON, new Vec3(0.0, -1.0, 0.0), Map.entry(LayeredCauldronBlock.LEVEL, 3))
.hasItemIngredient(new Vec3(0.0, -1.0, 0.0), item)
.spawnItem(new Vec3(0.0, -1.0, 0.0), item1)
.setBlock(Blocks.CAULDRON.defaultBlockState())
.unlockedBy(AnvilCraftDatagen.hasItem(item), AnvilCraftDatagen.has(item))
.save(provider, AnvilCraft.of("timewarp/" + BuiltInRegistries.ITEM.getKey(item1).getPath()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ public static void init(RegistrateRecipeProvider provider) {
.define('B', ModItems.SAPPHIRE)
.unlockedBy("hasitem", AnvilCraftDatagen.has(ModItems.SEA_HEART_SHELL))
.save(provider);
ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.CIRCUIT_BOARD)
.pattern("BCB")
.pattern("AAA")
.define('A', ModItems.HARDEND_RESIN)
.define('B', Items.COPPER_INGOT)
.define('C', Items.QUARTZ)
.unlockedBy("hasitem", AnvilCraftDatagen.has(ModItems.HARDEND_RESIN))
.save(provider);

SimpleCookingRecipeBuilder.campfireCooking(Ingredient.of(ModItemTags.DOUGH), RecipeCategory.FOOD,
Items.BREAD, 0.35f, 600)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public class ModItemGroups {
entries.accept(ModItems.SAPPHIRE.get().getDefaultInstance());
entries.accept(ModItems.RESIN.get().getDefaultInstance());
entries.accept(ModItems.AMBER.get().getDefaultInstance());
entries.accept(ModItems.HARDEND_RESIN.get().getDefaultInstance());
entries.accept(ModItems.WOOD_FIBER.get().getDefaultInstance());
entries.accept(ModItems.CIRCUIT_BOARD.get().getDefaultInstance());
entries.accept(ModItems.SPONGE_GEMMULE.get().getDefaultInstance());
entries.accept(ModItems.SEA_HEART_SHELL_SHARD.get().getDefaultInstance());
entries.accept(ModItems.SEA_HEART_SHELL.get().getDefaultInstance());
Expand Down
9 changes: 9 additions & 0 deletions common/src/main/java/dev/dubhe/anvilcraft/init/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,15 @@ public void appendHoverText(
.save(provider)
)
.register();
public static final ItemEntry<Item> HARDEND_RESIN = REGISTRATE
.item("hardend_resin", Item::new)
.register();
public static final ItemEntry<Item> WOOD_FIBER = REGISTRATE
.item("wood_fiber", Item::new)
.register();
public static final ItemEntry<Item> CIRCUIT_BOARD = REGISTRATE
.item("circuit_board", Item::new)
.register();
public static final ItemEntry<Item> PRISMARINE_BLADE = REGISTRATE
.item("prismarine_blade", Item::new)
.register();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"item.anvilcraft.chocolate": "ǝʇɐןoɔoɥƆ",
"item.anvilcraft.chocolate_black": "ʞɔɐןᗺ ǝʇɐןoɔoɥƆ",
"item.anvilcraft.chocolate_white": "ǝʇıɥM ǝʇɐןoɔoɥƆ",
"item.anvilcraft.circuit_board": "pɹɐoᗺ ʇınɔɹıƆ",
"item.anvilcraft.cocoa_butter": "ɹǝʇʇnᗺ ɐoɔoƆ",
"item.anvilcraft.cocoa_liquor": "ɹonbıꞀ ɐoɔoƆ",
"item.anvilcraft.cocoa_powder": "ɹǝpʍoԀ ɐoɔoƆ",
Expand All @@ -50,6 +51,7 @@
"item.anvilcraft.flour": "ɹnoןℲ",
"item.anvilcraft.geode": "ǝpoǝ⅁",
"item.anvilcraft.geode.find": "%s pǝʇɐɔoן 'ǝpoǝb ʇsʎɥʇǝɯɐ pǝʇɔǝdsnS",
"item.anvilcraft.hardend_resin": "uısǝᴚ puǝpɹɐH",
"item.anvilcraft.magnet": "ʇǝubɐW",
"item.anvilcraft.magnet_ingot": "ʇobuI ʇǝubɐW",
"item.anvilcraft.nether_star_shard": "pɹɐɥS ɹɐʇS ɹǝɥʇǝN",
Expand All @@ -70,6 +72,7 @@
"item.anvilcraft.topaz": "zɐdo⟘",
"item.anvilcraft.utusan": "uɐsnʇ∩",
"item.anvilcraft.utusan_raw": "ʍɐᴚ uɐsnʇ∩",
"item.anvilcraft.wood_fiber": "ɹǝqıℲ pooM",
"item.minecraft.smithing_template": "ǝʇɐןdɯǝ⟘ buıɥʇıɯS ǝpɐɹbd∩ ןǝǝʇS ןɐʎoᴚ",
"itemGroup.anvilcraft.block": "ʞɔoןᗺ",
"itemGroup.anvilcraft.item": "ɯǝʇI",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"item.anvilcraft.chocolate": "Chocolate",
"item.anvilcraft.chocolate_black": "Chocolate Black",
"item.anvilcraft.chocolate_white": "Chocolate White",
"item.anvilcraft.circuit_board": "Circuit Board",
"item.anvilcraft.cocoa_butter": "Cocoa Butter",
"item.anvilcraft.cocoa_liquor": "Cocoa Liquor",
"item.anvilcraft.cocoa_powder": "Cocoa Powder",
Expand All @@ -50,6 +51,7 @@
"item.anvilcraft.flour": "Flour",
"item.anvilcraft.geode": "Geode",
"item.anvilcraft.geode.find": "Suspected amethyst geode, located %s",
"item.anvilcraft.hardend_resin": "Hardend Resin",
"item.anvilcraft.magnet": "Magnet",
"item.anvilcraft.magnet_ingot": "Magnet Ingot",
"item.anvilcraft.nether_star_shard": "Nether Star Shard",
Expand All @@ -70,6 +72,7 @@
"item.anvilcraft.topaz": "Topaz",
"item.anvilcraft.utusan": "Utusan",
"item.anvilcraft.utusan_raw": "Utusan Raw",
"item.anvilcraft.wood_fiber": "Wood Fiber",
"item.minecraft.smithing_template": "Royal Steel Upgrade Smithing Template",
"itemGroup.anvilcraft.block": "Block",
"itemGroup.anvilcraft.item": "Item",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "anvilcraft:item/circuit_board"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "anvilcraft:item/hardend_resin"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "anvilcraft:item/wood_fiber"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_resin": {
"conditions": {
"items": [
{
"items": [
"anvilcraft:resin"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "minecraft:cook/hardend_resin"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_resin",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"minecraft:cook/hardend_resin"
]
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_the_recipe": {
"conditions": {
"recipe": "anvilcraft:circuit_board"
},
"trigger": "minecraft:recipe_unlocked"
},
"hasitem": {
"conditions": {
"items": [
{
"items": [
"anvilcraft:hardend_resin"
]
}
]
},
"trigger": "minecraft:inventory_changed"
}
},
"requirements": [
[
"hasitem",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"anvilcraft:circuit_board"
]
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_the_recipe": {
"conditions": {
"recipe": "anvilcraft:stamping/resin"
},
"trigger": "minecraft:recipe_unlocked"
},
"hasitem": {
"conditions": {
"items": [
{
"tag": "minecraft:logs"
}
]
},
"trigger": "minecraft:inventory_changed"
}
},
"requirements": [
[
"hasitem",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"anvilcraft:stamping/resin"
]
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_resin": {
"conditions": {
"items": [
{
"items": [
"anvilcraft:resin"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "anvilcraft:timewarp/amber"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_resin",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"anvilcraft:timewarp/amber"
]
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_resin_block": {
"conditions": {
"items": [
{
"items": [
"anvilcraft:resin_block"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "anvilcraft:timewarp/amber_block"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_resin_block",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"anvilcraft:timewarp/amber_block"
]
},
"sends_telemetry_event": false
}
Loading

0 comments on commit 06f826e

Please sign in to comment.