Advertisement
BandarHelal

Untitled

Jun 15th, 2021
807
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.66 KB | None | 0 0
  1.     @SubscribeEvent
  2.     public void didBreakWithAreaEffectEnchantment(BlockEvent.BreakEvent event) {
  3.         World world = (World)event.getWorld();
  4.         PlayerEntity player = event.getPlayer();
  5.         BlockPos pos = event.getPos();
  6.         ItemStack stack = player.getHeldItem(Hand.MAIN_HAND);
  7.         Direction headRot = player.getHorizontalFacing();
  8.  
  9.         if (ModItems.COPPER_PICKAXE.get().equals(stack.getItem())) {
  10.             int bx = pos.getX();
  11.             int by = pos.getY();
  12.             int bz = pos.getZ();
  13.             if (player.getLookVec().y <= -0.50f || player.getLookVec().y >= 0.50f) {
  14.                 for (int x = -1; x < 2; x++) {
  15.                     for (int z = -1; z < 2; z++) {
  16.                         BlockPos newBlockPos = new BlockPos(bx + x, by, bz + z);
  17.                         world.destroyBlock(newBlockPos, true);
  18.                     }
  19.                 }
  20.             } else if (headRot.equals(Direction.NORTH) || headRot.equals(Direction.SOUTH)) {
  21.                 for (int x = -1; x < 2; x++) {
  22.                     for (int y = -1; y < 2; y++) {
  23.                         BlockPos newBlockPos = new BlockPos(bx + x, by + y, bz);
  24.                         world.destroyBlock(newBlockPos, true);
  25.                     }
  26.                 }
  27.             } else if (headRot.equals(Direction.WEST) || headRot.equals(Direction.EAST)) {
  28.                 for (int z = -1; z < 2; z++) {
  29.                     for (int y = -1; y < 2; y++) {
  30.                         BlockPos newBlockPos = new BlockPos(bx, by + y, bz + z);
  31.                         world.destroyBlock(newBlockPos, true);
  32.                     }
  33.                 }
  34.             }
  35.         }
  36.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement