Skip to content

Commit

Permalink
大铁砧撼地粉碎
Browse files Browse the repository at this point in the history
  • Loading branch information
DancingSnow0517 committed Sep 30, 2024
1 parent 72d40ed commit e39df7a
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_the_recipe": {
"conditions": {
"recipe": "anvilcraft:block_crush/end_dust"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"anvilcraft:block_crush/end_dust"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_the_recipe": {
"conditions": {
"recipe": "anvilcraft:block_crush/nether_dust"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"anvilcraft:block_crush/nether_dust"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "anvilcraft:block_crush",
"input": "minecraft:end_stone",
"result": "anvilcraft:end_dust"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "anvilcraft:block_crush",
"input": "minecraft:netherrack",
"result": "anvilcraft:nether_dust"
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public static void init(RegistrateRecipeProvider provider) {
blockCrush(provider, Blocks.DEEPSLATE_TILES, Blocks.CRACKED_DEEPSLATE_TILES);
blockCrush(provider, Blocks.POLISHED_BLACKSTONE_BRICKS, Blocks.CRACKED_POLISHED_BLACKSTONE_BRICKS);
blockCrush(provider, Blocks.SOUL_SOIL, Blocks.SOUL_SAND);
blockCrush(provider, Blocks.NETHERRACK, ModBlocks.NETHER_DUST.get());
blockCrush(provider, Blocks.END_STONE, ModBlocks.END_DUST.get());
}

private static void blockCrush(RegistrateRecipeProvider provider, Block input, Block result) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import dev.dubhe.anvilcraft.init.ModBlockTags;
import dev.dubhe.anvilcraft.init.ModBlocks;
import dev.dubhe.anvilcraft.init.ModRecipeTypes;
import dev.dubhe.anvilcraft.recipe.anvil.BlockCrushRecipe;
import dev.dubhe.anvilcraft.recipe.multiblock.MultiblockInput;
import dev.dubhe.anvilcraft.util.AnvilUtil;

Expand Down Expand Up @@ -158,26 +159,18 @@ public class GiantAnvilLandingEventListener {
processChorus(pos, state, level);
}
}));
// behaviorDefs.add(new ShockBehaviorDefinition.SimpleBlock(Blocks.ANVIL,
// (blockPosList, level) -> {
// for (BlockPos pos : blockPosList) {
// BlockPos pos1 = pos.mutable();
// AnvilCraftingContext context = new AnvilCraftingContext(level, pos1, null);
// Optional<AnvilRecipe> optional =
// AnvilRecipeManager.getAnvilRecipeList().stream()
// .filter(recipe ->
// recipe.getAnvilRecipeType() ==
// AnvilRecipeType.BLOCK_SMASH
// && recipe.matches(context, level)
// ).findFirst();
// if (optional.isPresent()) {
// AnvilRecipe recipe = optional.get();
// recipe.craft(context.clearData());
// level.destroyBlock(pos.below(), true);
// }
// }
// })
// );
behaviorDefs.add(new ShockBehaviorDefinition.SimpleBlock(Blocks.ANVIL,
(blockPosList, level) -> {
for (BlockPos pos : blockPosList) {
BlockState state = level.getBlockState(pos);
BlockCrushRecipe.Input input = new BlockCrushRecipe.Input(state.getBlock());
level.getRecipeManager().getRecipeFor(ModRecipeTypes.BLOCK_CRUSH_TYPE.get(), input, level).ifPresent(recipe -> {
level.setBlockAndUpdate(pos, recipe.value().result.defaultBlockState());
level.destroyBlock(pos, true);
});
}
})
);
}

private static void processChorus(BlockPos pos, BlockState state, Level level) {
Expand Down

0 comments on commit e39df7a

Please sign in to comment.