Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SubscribeEvent
- public void didBreakWithAreaEffectEnchantment(BlockEvent.BreakEvent event) {
- World world = (World)event.getWorld();
- PlayerEntity player = event.getPlayer();
- BlockPos pos = event.getPos();
- ItemStack stack = player.getHeldItem(Hand.MAIN_HAND);
- Direction headRot = player.getHorizontalFacing();
- if (ModItems.COPPER_PICKAXE.get().equals(stack.getItem())) {
- int bx = pos.getX();
- int by = pos.getY();
- int bz = pos.getZ();
- if (player.getLookVec().y <= -0.50f || player.getLookVec().y >= 0.50f) {
- for (int x = -1; x < 2; x++) {
- for (int z = -1; z < 2; z++) {
- BlockPos newBlockPos = new BlockPos(bx + x, by, bz + z);
- world.destroyBlock(newBlockPos, true);
- }
- }
- } else if (headRot.equals(Direction.NORTH) || headRot.equals(Direction.SOUTH)) {
- for (int x = -1; x < 2; x++) {
- for (int y = -1; y < 2; y++) {
- BlockPos newBlockPos = new BlockPos(bx + x, by + y, bz);
- world.destroyBlock(newBlockPos, true);
- }
- }
- } else if (headRot.equals(Direction.WEST) || headRot.equals(Direction.EAST)) {
- for (int z = -1; z < 2; z++) {
- for (int y = -1; y < 2; y++) {
- BlockPos newBlockPos = new BlockPos(bx, by + y, bz + z);
- world.destroyBlock(newBlockPos, true);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement