MinecraftScripterAI
Discord ↗
Link Copied to Clipboard
×
"how do i make a pickaxe that destroys 3x3 area"
To make a pickaxe that destroys a 3x3 area, you would need to override the mineBlock method in your custom pickaxe class. In this method, you would loop through the surrounding blocks and break them as well. Here's an example of how you could do this: ```java public class CustomPickaxe extends PickaxeItem { // Constructor and other methods @Override public boolean mineBlock(ItemStack stack, Level world, BlockState state, BlockPos pos, LivingEntity miner) { if (!world.isClientSide && state.getDestroySpeed(world, pos) != 0.0F) { stack.hurtAndBreak(1, miner, (player) -> player.broadcastBreakEvent(EquipmentSlot.MAINHAND)); // Loop through the surrounding blocks in a 3x3 area for (int x = -1; x <= 1; x++) { for (int y = -1; y <= 1; y++) { for (int z = -1; z <= 1; z++) { // Skip the center block, as it's already being mined if (x == 0 && y == 0 && z == 0) { continue; } BlockPos targetPos = pos.offset(x, y, z); BlockState targetState = world.getBlockState(targetPos); // Check if the block can be destroyed by this pickaxe if (targetState.getDestroySpeed(world, targetPos) > 0.0F && this.getTier().getLevel() >= targetState.getHarvestLevel()) { world.destroyBlock(targetPos, true, miner); } } } } } return true; } } ``` This code will create a custom pickaxe that mines a 3x3 area around the targeted block. Remember to register your custom pickaxe in your mod's item registry.