Exemplo n.º 1
0
  public static void checkBlockInteraction(
      Resident res, BlockPos bp, PlayerInteractEvent.Action action, Event ev) {
    if (!ev.isCancelable()) {
      return;
    }
    World world = MinecraftServer.getServer().worldServerForDimension(bp.getDim());
    Block block = world.getBlock(bp.getX(), bp.getY(), bp.getZ());

    for (SegmentBlock segment : segmentsBlock.get(block.getClass())) {
      if (!segment.shouldInteract(res, bp, action)) {
        ev.setCanceled(true);
      }
    }
  }