@@ -42,54 +42,7 @@ object VoidBoundEvents {
42
42
BlockEvents .BLOCK_BREAK .register(VoidBoundWorldComponent .Companion ::removeWard)
43
43
BlockEvents .BLOCK_BREAK .register(TidecutterItem .Companion ::breakBlock)
44
44
45
- BlockEvents .BLOCK_BREAK .register { event ->
46
- val player = event?.player
47
45
48
- if (player?.level() is ServerLevel ) {
49
- val level = player.level() as ? ServerLevel
50
- val pos = event.pos
51
- if (VoidBoundApi .getActiveAbility(player.mainHandItem) == ItemAbility .AUTOSMELT ) {
52
- val blockState = level!! .getBlockState(pos)
53
- val blockEntity = level.getBlockEntity(pos)
54
-
55
- // Get the list of dropped items from the block
56
- val drops: MutableList <ItemStack > = Block .getDrops(blockState, level, pos, blockEntity)
57
-
58
- // Retrieve all smelting recipes
59
- val allSmeltingRecipes = level.recipeManager.getAllRecipesFor(RecipeType .SMELTING )
60
-
61
- // Create a map of ItemStack to its smelted result
62
- val smeltedResults = mutableMapOf<ItemStack , ItemStack >()
63
-
64
- // Populate the smeltedResults map
65
- for (recipe in allSmeltingRecipes) {
66
- if (recipe is SmeltingRecipe ) {
67
- for (ingredient in recipe.ingredients) {
68
- val smeltedResult = recipe.getResultItem(level.registryAccess())
69
- for (item in drops) {
70
- if (ingredient.test(item)) {
71
- smeltedResults[item] = smeltedResult
72
- }
73
- }
74
- }
75
- }
76
- }
77
-
78
- // Drop smelted items instead of original items
79
- for ((item, smeltedResult) in smeltedResults) {
80
- // Remove the original item from the list
81
- drops.remove(item)
82
- // Drop the smelted result
83
- Block .popResource(level, pos, smeltedResult)
84
- }
85
-
86
- // Drop the original items that didn't have a smelting recipe
87
- for (item in drops) {
88
- Block .popResource(level, pos, item)
89
- }
90
- }
91
- }
92
- }
93
46
94
47
/* *
95
48
* Add extra damage to UpgradableTools when it has extra damage
0 commit comments