Skip to content

Commit

Permalink
Merge pull request #431 from Anvil-Dev/melt_gem
Browse files Browse the repository at this point in the history
添加熔融宝石炼药锅和相关配方
  • Loading branch information
Gu-ZT authored Apr 28, 2024
2 parents 8ce277c + db586fb commit 34bdadc
Show file tree
Hide file tree
Showing 38 changed files with 1,381 additions and 126 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package dev.dubhe.anvilcraft.block;

import net.minecraft.core.BlockPos;
import net.minecraft.core.cauldron.CauldronInteraction;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.AbstractCauldronBlock;
import net.minecraft.world.level.block.state.BlockState;

public class MeltGemCauldron extends AbstractCauldronBlock {

public MeltGemCauldron(Properties properties) {
super(properties, CauldronInteraction.EMPTY);
}

@Override
protected double getContentHeight(BlockState state) {
return 0.9375;
}

@Override
public boolean isFull(BlockState state) {
return true;
}

@Override
public int getAnalogOutputSignal(BlockState state, Level level, BlockPos pos) {
return 3;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package dev.dubhe.anvilcraft.data.generator.recipe;

import com.tterrag.registrate.providers.RegistrateRecipeProvider;
import dev.dubhe.anvilcraft.AnvilCraft;
import dev.dubhe.anvilcraft.data.generator.AnvilCraftDatagen;
import dev.dubhe.anvilcraft.data.recipe.anvil.AnvilRecipe;
import dev.dubhe.anvilcraft.init.ModBlocks;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.phys.Vec3;

import java.util.Map;

import static dev.dubhe.anvilcraft.api.power.IPowerComponent.OVERLOAD;

public class HeaterRecipesLoader {
/**
* 初始化加热器配方
*
* @param provider 提供器
*/
public static void init(RegistrateRecipeProvider provider) {
AnvilRecipe.Builder.create(RecipeCategory.MISC)
.icon(Items.EMERALD_BLOCK)
.hasBlock(ModBlocks.HEATER.get(), new Vec3(0, -2, 0), Map.entry(OVERLOAD, false))
.hasBlockIngredient(new Vec3(0, -1, 0), Blocks.CAULDRON)
.hasItemIngredient(
new Vec3(0, -1, 0),
Items.EMERALD_BLOCK,
ModBlocks.RUBY_BLOCK,
ModBlocks.TOPAZ_BLOCK,
ModBlocks.SAPPHIRE_BLOCK
)
.setBlock(new Vec3(0, -1, 0), ModBlocks.MELT_GEM_CAULDRON.get())
.unlockedBy(
AnvilCraftDatagen.hasItem(Items.EMERALD_BLOCK), AnvilCraftDatagen.has(Items.EMERALD_BLOCK)
)
.unlockedBy(
AnvilCraftDatagen.hasItem(ModBlocks.RUBY_BLOCK), AnvilCraftDatagen.has(ModBlocks.RUBY_BLOCK)
)
.unlockedBy(
AnvilCraftDatagen.hasItem(ModBlocks.TOPAZ_BLOCK), AnvilCraftDatagen.has(ModBlocks.TOPAZ_BLOCK)
)
.unlockedBy(
AnvilCraftDatagen.hasItem(ModBlocks.SAPPHIRE_BLOCK), AnvilCraftDatagen.has(ModBlocks.SAPPHIRE_BLOCK)
)
.save(provider, AnvilCraft.of("heating/melt_gem_cauldron"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public static void init(RegistrateRecipeProvider provider) {
CompactionRecipesLoader.init(provider);
CompressRecipesLoader.init(provider);
CookingRecipesLoader.init(provider);
HeaterRecipesLoader.init(provider);
ItemInjectRecipesLoader.init(provider);
SmashBlockRecipesLoader.init(provider);
SievingRecipesLoader.init(provider);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public static void init(RegistrateRecipeProvider provider) {
timeWarp(ModBlocks.CINERITE, Items.TUFF, 1, provider);
timeWarp(ModBlocks.NETHER_DUST, Items.SOUL_SOIL, 1, provider);
timeWarp(ModBlocks.END_DUST, Items.END_STONE, 1, provider);

timeWarpWithMeltGem(Items.EMERALD, Items.EMERALD_BLOCK, provider);
timeWarpWithMeltGem(ModItems.RUBY, ModBlocks.RUBY_BLOCK, provider);
timeWarpWithMeltGem(ModItems.TOPAZ, ModBlocks.TOPAZ_BLOCK, provider);
timeWarpWithMeltGem(ModItems.SAPPHIRE, ModBlocks.SAPPHIRE_BLOCK, provider);
}

/**
Expand Down Expand Up @@ -73,4 +78,23 @@ public static void timeWarpWithWater(ItemLike item, ItemLike item1, RegistrateRe
.unlockedBy(AnvilCraftDatagen.hasItem(item), AnvilCraftDatagen.has(item))
.save(provider, AnvilCraft.of("timewarp/" + BuiltInRegistries.ITEM.getKey(item1.asItem()).getPath()));
}

public static void timeWarpWithMeltGem(ItemLike item, ItemLike item1, RegistrateRecipeProvider provider) {

Check warning on line 82 in common/src/main/java/dev/dubhe/anvilcraft/data/generator/recipe/TimeWarpRecipesLoader.java

View workflow job for this annotation

GitHub Actions / checkstyle

[Checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /home/runner/work/AnvilCraft/AnvilCraft/common/src/main/java/dev/dubhe/anvilcraft/data/generator/recipe/TimeWarpRecipesLoader.java:82:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
AnvilRecipe.Builder.create(RecipeCategory.MISC)
.icon(item1)
.hasBlock(
ModBlocks.CORRUPTED_BEACON.get(),
new Vec3(0.0, -2.0, 0.0),
Map.entry(CorruptedBeaconBlock.LIT, true)
)
.hasBlockIngredient(
new Vec3(0, -1, 0),
ModBlocks.MELT_GEM_CAULDRON.get()
)
.hasItemIngredient(new Vec3(0, -1, 0), item)
.spawnItem(new Vec3(0.0, -1.0, 0.0), item1)
.setBlock(new Vec3(0, -1, 0), Blocks.CAULDRON)
.unlockedBy(AnvilCraftDatagen.hasItem(item), AnvilCraftDatagen.has(item))
.save(provider, AnvilCraft.of("timewarp/" + BuiltInRegistries.ITEM.getKey(item1.asItem()).getPath()));
}
}
10 changes: 10 additions & 0 deletions common/src/main/java/dev/dubhe/anvilcraft/init/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import dev.dubhe.anvilcraft.block.JewelCraftingTable;
import dev.dubhe.anvilcraft.block.LavaCauldronBlock;
import dev.dubhe.anvilcraft.block.MagnetBlock;
import dev.dubhe.anvilcraft.block.MeltGemCauldron;
import dev.dubhe.anvilcraft.block.PiezoelectricCrystalBlock;
import dev.dubhe.anvilcraft.block.ResinBlock;
import dev.dubhe.anvilcraft.block.RoyalAnvilBlock;
Expand Down Expand Up @@ -710,6 +711,15 @@ public class ModBlocks {
.save(provider))
.register();

public static final BlockEntry<MeltGemCauldron> MELT_GEM_CAULDRON = REGISTRATE
.block("melt_gem_cauldron", MeltGemCauldron::new)
.initialProperties(() -> Blocks.CAULDRON)
.blockstate((ctx, provider) -> {
})
.loot((tables, block) -> tables.dropOther(block, Items.CAULDRON))
.tag(BlockTags.MINEABLE_WITH_PICKAXE)
.register();

public static void register() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "anvilcraft:block/melt_gem_cauldron"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"block.anvilcraft.jewelcrafting_table": "ǝןqɐ⟘ buıʇɟɐɹƆ ןǝʍǝſ",
"block.anvilcraft.lava_cauldron": "uoɹpןnɐƆ ɐʌɐꞀ",
"block.anvilcraft.magnet_block": "ʞɔoןᗺ ʇǝubɐW",
"block.anvilcraft.melt_gem_cauldron": "uoɹpןnɐƆ ɯǝ⅁ ʇןǝW",
"block.anvilcraft.nether_dust": "ʇsnᗡ ɹǝɥʇǝN",
"block.anvilcraft.piezoelectric_crystal": "ןɐʇsʎɹƆ ɔıɹʇɔǝןǝozǝıԀ",
"block.anvilcraft.quartz_sand": "puɐS zʇɹɐnὉ",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"block.anvilcraft.jewelcrafting_table": "Jewel Crafting Table",
"block.anvilcraft.lava_cauldron": "Lava Cauldron",
"block.anvilcraft.magnet_block": "Magnet Block",
"block.anvilcraft.melt_gem_cauldron": "Melt Gem Cauldron",
"block.anvilcraft.nether_dust": "Nether Dust",
"block.anvilcraft.piezoelectric_crystal": "Piezoelectric Crystal",
"block.anvilcraft.quartz_sand": "Quartz Sand",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_emerald_block": {
"conditions": {
"items": [
{
"items": [
"minecraft:emerald_block"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_ruby_block": {
"conditions": {
"items": [
{
"items": [
"anvilcraft:ruby_block"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_sapphire_block": {
"conditions": {
"items": [
{
"items": [
"anvilcraft:sapphire_block"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "anvilcraft:heating/melt_gem_cauldron"
},
"trigger": "minecraft:recipe_unlocked"
},
"has_topaz_block": {
"conditions": {
"items": [
{
"items": [
"anvilcraft:topaz_block"
]
}
]
},
"trigger": "minecraft:inventory_changed"
}
},
"requirements": [
[
"has_emerald_block",
"has_ruby_block",
"has_topaz_block",
"has_sapphire_block",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"anvilcraft:heating/melt_gem_cauldron"
]
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_nether_star": {
"has_netherite_crystal_nucleus": {
"conditions": {
"items": [
{
"items": [
"minecraft:nether_star"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_royal_steel_ingot": {
"conditions": {
"items": [
{
"items": [
"anvilcraft:royal_steel_ingot"
"anvilcraft:netherite_crystal_nucleus"
]
}
]
Expand All @@ -30,25 +18,11 @@
"recipe": "anvilcraft:timewarp/ancient_debris"
},
"trigger": "minecraft:recipe_unlocked"
},
"has_tungsten_ingot": {
"conditions": {
"items": [
{
"items": [
"anvilcraft:tungsten_ingot"
]
}
]
},
"trigger": "minecraft:inventory_changed"
}
},
"requirements": [
[
"has_tungsten_ingot",
"has_royal_steel_ingot",
"has_nether_star",
"has_netherite_crystal_nucleus",
"has_the_recipe"
]
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_emerald": {
"conditions": {
"items": [
{
"items": [
"minecraft:emerald"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "anvilcraft:timewarp/emerald_block"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_emerald",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"anvilcraft:timewarp/emerald_block"
]
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_ruby": {
"conditions": {
"items": [
{
"items": [
"anvilcraft:ruby"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "anvilcraft:timewarp/ruby_block"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_ruby",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"anvilcraft:timewarp/ruby_block"
]
},
"sends_telemetry_event": false
}
Loading

0 comments on commit 34bdadc

Please sign in to comment.